25 #include <Classes.hpp>
26 #include <Controls.hpp>
27 #include <StdCtrls.hpp>
29 #include <Buttons.hpp>
30 #include <ExtCtrls.hpp>
32 #include <Dialogs.hpp>
33 #include <Graphics.hpp>
34 #include <ComCtrls.hpp>
50 #pragma package(smart_init)
63 Graphics::TBitmap* SmallGraphicPtrVal) : SpeedTag(SpeedTagVal), TrackType(TrackTypeVal), GraphicPtr(GraphicPtrVal), SmallGraphicPtr(SmallGraphicPtrVal)
65 for(
int x = 0; x < 4; x++)
76 else if(SpeedTagVal == 77)
80 else if(SpeedTagVal == 78)
84 else if(SpeedTagVal == 79)
88 else if(SpeedTagVal == 96)
92 else if(SpeedTagVal == 129)
96 else if(SpeedTagVal == 130)
100 else if(SpeedTagVal == 131)
104 else if(SpeedTagVal == 145)
108 else if(SpeedTagVal == 146)
117 FixedNamedLocationElement(false)
119 for(
int x = 0; x < 4; x++)
130 AnsiString(VLocInput));
143 if((this->
HLoc == RHElement.
HLoc) && (this->VLoc == RHElement.
VLoc) && (this->SpeedTag == RHElement.
SpeedTag))
157 if((this->
HLoc != RHElement.
HLoc) || (this->VLoc != RHElement.
VLoc) || (this->SpeedTag != RHElement.
SpeedTag))
173 Graphics::TBitmap *GraphicOutput = GraphicPtr;
175 if(LocationName ==
"")
220 GraphicOutput = GraphicPtr;
224 Disp->PlotOutput(34, HLoc * 16, VLoc * 16, GraphicOutput);
226 if((TrackType ==
Simple) && Failed)
238 AnsiString LogString =
"TrkEl:-," + AnsiString(ElementID) +
"," + LocationName +
"," + AnsiString(TrainIDOnElement) +
"," +
239 AnsiString(TrainIDOnBridgeOrFailedPointOrigSpeedLimit01) +
"," + AnsiString(TrainIDOnBridgeOrFailedPointOrigSpeedLimit23) +
",EndTrkEl,";
248 Attribute(0), CallingOnSet(false), Length01(
Utilities->DefaultTrackLength), Length23(-1), SpeedLimit01(
Utilities->DefaultTrackSpeedLimit), SpeedLimit23(-1),
249 TrainIDOnElement(-1), TrainIDOnBridgeOrFailedPointOrigSpeedLimit01(-1), TrainIDOnBridgeOrFailedPointOrigSpeedLimit23(-1), StationEntryStopLinkPos1(-1),
250 StationEntryStopLinkPos2(-1), StationEntryStopLinkPos3(-1), StationEntryStopLinkPos4(-1), SigAspect(FourAspect)
253 for(
int x = 0; x < 4; x++)
269 if(lower.second < higher.second)
273 else if(lower.second > higher.second)
277 else if(lower.second == higher.second)
279 if(lower.first < higher.first)
292 :
TTrackElement(ElementIn), ELink(ELinkIn), ELinkPos(ELinkPosIn), XLink(XLinkIn), XLinkPos(XLinkPosIn), TrackVectorPosition(TrackVectorPositionIn),
293 CheckCount(9), IsARoute(false), AutoSignals(false), PrefDirRoute(false)
297 throw Exception(
"EXNumber failure in TPrefDirElement constructor");
308 AnsiString LogString =
"PthEl:-," + AnsiString(
ELink) +
"," + AnsiString(
ELinkPos) +
"," + AnsiString(
XLink) +
"," + AnsiString(
XLinkPos) +
"," +
336 {2, 4}, {6, 2}, {8, 6}, {4, 8},
337 {1, 6}, {3, 8}, {9, 4}, {7, 2}, {1, 8}, {3, 4}, {9, 2}, {7, 6},
347 else if(
Link[2] == -1)
360 else if(
Link[2] == -1)
369 for(
int x = 0; x < 16; x++)
371 if(((Entry == EXArray[x][0]) && (Exit == EXArray[x][1])) || ((Entry == EXArray[x][1]) && (Exit == EXArray[x][0])))
547 throw Exception(
"Error in EntryExitNumber 4");
642 throw Exception(
"Error in EntryExitNumber 5");
736 throw Exception(
"Error in EntryExitNumber 6");
823 throw Exception(
"Error in EntryExitNumber 10");
912 throw Exception(
"Error in EntryExitNumber 11");
1008 throw Exception(
"Error in EntryExitNumber 7");
1039 throw Exception(
"Error in EntryExitNumber 8");
1050 if((ELink > 0) && (ELink < 10) && (ELink != 5))
1052 if(!AutoSigsFlag && !PrefDirRoute)
1056 else if(!AutoSigsFlag && PrefDirRoute)
1067 throw Exception(
"Error in EntryExitNumber 9");
1164 AnsiString NL =
'\n';
1166 RouteFailMessage =
"Unable to set a route:" + NL + NL +
"it may be unreachable, perhaps because of failed points; " + NL + NL +
1167 "reachable but too far ahead or with too many different directions leading away from the start point - set some points on the route required; " + NL + NL +
1168 "blocked by a train, another route or a changing level crossing; " + NL + NL +
1169 "or invalid - possibly due to a preferred direction mismatch, or a missed signal in a blue route or green route restricted to consecutive signals.";
1178 int InternalLinkCheckArray[9][2] =
1179 {{1, 9}, {4, 6}, {7, 3}, {2, 8}, {0, 0}, {8, 2}, {3, 7}, {6, 4}, {9, 1}};
1184 for(
int x = 0; x < 9; x++)
1186 for(
int y = 0; y < 2; y++)
1193 TopPlatAllowed << 1 << 9 << 10 << 30 << 31 << 60 << 61 << 68 << 69 << 77 << 125 << 126 << 129 << 145;
1195 BotPlatAllowed << 1 << 7 << 8 << 28 << 29 << 60 << 61 << 68 << 69 << 76 << 125 << 126 << 129 << 145;
1196 LeftPlatAllowed << 2 << 12 << 14 << 33 << 35 << 62 << 63 << 70 << 71 << 79 << 127 << 128 << 130 << 146;
1197 RightPlatAllowed << 2 << 11 << 13 << 32 << 34 << 62 << 63 << 70 << 71 << 78 << 127 << 128 << 130 << 146;
1198 NameAllowed << 1 << 2 << 3 << 4 << 5 << 6 << 7 << 8 << 9 << 10 << 11 << 12 << 13 << 14 << 15 << 16 << 18 << 19 << 20 << 21 << 22 << 23 << 24
1199 << 25 << 26 << 27 << 28 << 29 << 30 << 31 << 32 << 33 << 34 << 35 << 36 << 37 << 38 << 39 << 40 << 41 << 42 << 43 << 44 << 45 << 46 << 47
1200 << 60 << 61 << 62 << 63 << 64 << 65 << 66 << 67 << 68 << 69 << 70 << 71 << 72 << 73 << 74 << 75 << 80 << 81 << 82 << 83 << 84 << 85 << 86
1201 << 87 << 125 << 126 << 127 << 128 << 132 << 133 << 134 << 135 << 136 << 137 << 138 << 139
1202 << 140 << 141 << 142 << 143;
1207 int HVArray[10][2] =
1208 {{0, 0}, {-1, -1}, {0, -1}, {1, -1}, {-1, 0}, {0, 0}, {1, 0}, {-1, 1}, {0, 1}, {1, 1}};
1210 for(
int x = 0; x < 10; x++)
1212 for(
int y = 0; y < 2; y++)
1221 {{68, 0,
RailGraphics->
gl68}, {69, 0,
RailGraphics->
gl69}, {70, 0,
RailGraphics->
gl70}, {71, 0,
RailGraphics->
gl71}, {72, 0,
RailGraphics->
gl72},
1224 {68, 1,
RailGraphics->
bm68yellow}, {69, 1,
RailGraphics->
bm69yellow}, {70, 1,
RailGraphics->
bm70yellow}, {71, 1,
RailGraphics->
bm71yellow},
1225 {72, 1,
RailGraphics->
bm72yellow}, {73, 1,
RailGraphics->
bm73yellow}, {74, 1,
RailGraphics->
bm74yellow}, {75, 1,
RailGraphics->
bm75yellow},
1227 {68, 2,
RailGraphics->
bm68dblyellow}, {69, 2,
RailGraphics->
bm69dblyellow}, {70, 2,
RailGraphics->
bm70dblyellow}, {71, 2,
RailGraphics->
bm71dblyellow},
1228 {72, 2,
RailGraphics->
bm72dblyellow}, {73, 2,
RailGraphics->
bm73dblyellow}, {74, 2,
RailGraphics->
bm74dblyellow}, {75, 2,
RailGraphics->
bm75dblyellow},
1230 {68, 3,
RailGraphics->
bm68green}, {69, 3,
RailGraphics->
bm69green}, {70, 3,
RailGraphics->
bm70green}, {71, 3,
RailGraphics->
bm71green},
1231 {72, 3,
RailGraphics->
bm72green}, {73, 3,
RailGraphics->
bm73green}, {74, 3,
RailGraphics->
bm74green}, {75, 3,
RailGraphics->
bm75green},
1234 {70, 4,
RailGraphics->
gl70}, {71, 4,
RailGraphics->
gl71}, {72, 4,
RailGraphics->
gl72}, {73, 4,
RailGraphics->
bm73}, {74, 4,
RailGraphics->
bm74},
1237 for(
int x = 0; x < 40; x++)
1243 {{68, 0,
RailGraphics->
gl68}, {69, 0,
RailGraphics->
gl69}, {70, 0,
RailGraphics->
gl70}, {71, 0,
RailGraphics->
gl71}, {72, 0,
RailGraphics->
gl72},
1246 {68, 1,
RailGraphics->
bm68yellow}, {69, 1,
RailGraphics->
bm69yellow}, {70, 1,
RailGraphics->
bm70yellow}, {71, 1,
RailGraphics->
bm71yellow},
1247 {72, 1,
RailGraphics->
bm72yellow}, {73, 1,
RailGraphics->
bm73yellow}, {74, 1,
RailGraphics->
bm74yellow}, {75, 1,
RailGraphics->
bm75yellow},
1249 {68, 2,
RailGraphics->
bm68green}, {69, 2,
RailGraphics->
bm69green}, {70, 2,
RailGraphics->
bm70green}, {71, 2,
RailGraphics->
bm71green},
1250 {72, 2,
RailGraphics->
bm72green}, {73, 2,
RailGraphics->
bm73green}, {74, 2,
RailGraphics->
bm74green}, {75, 2,
RailGraphics->
bm75green},
1252 {68, 3,
RailGraphics->
bm68green}, {69, 3,
RailGraphics->
bm69green}, {70, 3,
RailGraphics->
bm70green}, {71, 3,
RailGraphics->
bm71green},
1253 {72, 3,
RailGraphics->
bm72green}, {73, 3,
RailGraphics->
bm73green}, {74, 3,
RailGraphics->
bm74green}, {75, 3,
RailGraphics->
bm75green},
1256 {70, 4,
RailGraphics->
gl70}, {71, 4,
RailGraphics->
gl71}, {72, 4,
RailGraphics->
gl72}, {73, 4,
RailGraphics->
bm73}, {74, 4,
RailGraphics->
bm74},
1259 for(
int x = 0; x < 40; x++)
1265 {{68, 0,
RailGraphics->
gl68}, {69, 0,
RailGraphics->
gl69}, {70, 0,
RailGraphics->
gl70}, {71, 0,
RailGraphics->
gl71}, {72, 0,
RailGraphics->
gl72},
1268 {68, 1,
RailGraphics->
bm68green}, {69, 1,
RailGraphics->
bm69green}, {70, 1,
RailGraphics->
bm70green}, {71, 1,
RailGraphics->
bm71green},
1269 {72, 1,
RailGraphics->
bm72green}, {73, 1,
RailGraphics->
bm73green}, {74, 1,
RailGraphics->
bm74green}, {75, 1,
RailGraphics->
bm75green},
1271 {68, 2,
RailGraphics->
bm68green}, {69, 2,
RailGraphics->
bm69green}, {70, 2,
RailGraphics->
bm70green}, {71, 2,
RailGraphics->
bm71green},
1272 {72, 2,
RailGraphics->
bm72green}, {73, 2,
RailGraphics->
bm73green}, {74, 2,
RailGraphics->
bm74green}, {75, 2,
RailGraphics->
bm75green},
1274 {68, 3,
RailGraphics->
bm68green}, {69, 3,
RailGraphics->
bm69green}, {70, 3,
RailGraphics->
bm70green}, {71, 3,
RailGraphics->
bm71green},
1275 {72, 3,
RailGraphics->
bm72green}, {73, 3,
RailGraphics->
bm73green}, {74, 3,
RailGraphics->
bm74green}, {75, 3,
RailGraphics->
bm75green},
1278 {70, 4,
RailGraphics->
gl70}, {71, 4,
RailGraphics->
gl71}, {72, 4,
RailGraphics->
gl72}, {73, 4,
RailGraphics->
bm73}, {74, 4,
RailGraphics->
bm74},
1281 for(
int x = 0; x < 40; x++)
1307 for(
int x = 0; x < 40; x++)
1313 {{68, 0,
RailGraphics->
FSig68}, {69, 0,
RailGraphics->
FSig69}, {70, 0,
RailGraphics->
FSig70}, {71, 0,
RailGraphics->
FSig71}, {72, 0,
RailGraphics->
FSig72},
1316 for(
int x = 0; x < 8; x++)
1322 {{68, 0,
RailGraphics->
FGSig68}, {69, 0,
RailGraphics->
FGSig69}, {70, 0,
RailGraphics->
FGSig70}, {71, 0,
RailGraphics->
FGSig71}, {72, 0,
RailGraphics->
FGSig72},
1325 for(
int x = 0; x < 8; x++)
1352 {1, 0, 96}, {0, -1, 96}, {0, 1, 96}, {-1, 0, 76},
1353 {1, 0, 76}, {0, -1, 76}, {0, 1, 76}, {-1, 0, 77},
1354 {1, 0, 77}, {0, -1, 77}, {0, 1, 77}, {0, 0, 77}, {-1, 0, 78},
1355 {1, 0, 78}, {0, -1, 78}, {0, 1, 78}, {-1, 0, 79},
1356 {1, 0, 79}, {0, -1, 79}, {0, 1, 79}, {0, -1, 129},
1357 {0, 0, 129}, {0, -1, 145},
1360 for(
int x = 0; x < 25; x++)
1362 for(
int y = 0; y < 3; y++)
1370 {1, 0, 96}, {0, -1, 96}, {0, 1, 96}, {-1, 0, 76},
1371 {1, 0, 76}, {0, -1, 76}, {0, 1, 76}, {0, 0, 76}, {-1, 0, 77},
1372 {1, 0, 77}, {0, -1, 77}, {0, 1, 77}, {-1, 0, 78},
1373 {1, 0, 78}, {0, -1, 78}, {0, 1, 78}, {-1, 0, 79},
1374 {1, 0, 79}, {0, -1, 79}, {0, 1, 79}, {0, 1, 129},
1375 {0, 0, 129}, {0, 1, 145},
1378 for(
int x = 0; x < 25; x++)
1380 for(
int y = 0; y < 3; y++)
1388 {1, 0, 96}, {0, -1, 96}, {0, 1, 96}, {-1, 0, 76},
1389 {1, 0, 76}, {0, -1, 76}, {0, 1, 76}, {-1, 0, 77},
1390 {1, 0, 77}, {0, -1, 77}, {0, 1, 77}, {-1, 0, 78},
1391 {1, 0, 78}, {0, -1, 78}, {0, 1, 78}, {-1, 0, 79},
1392 {1, 0, 79}, {0, -1, 79}, {0, 1, 79}, {0, 0, 79}, {-1, 0, 130},
1393 {0, 0, 130}, {-1, 0, 146},
1396 for(
int x = 0; x < 25; x++)
1398 for(
int y = 0; y < 3; y++)
1406 {1, 0, 96}, {0, -1, 96}, {0, 1, 96}, {-1, 0, 76},
1407 {1, 0, 76}, {0, -1, 76}, {0, 1, 76}, {-1, 0, 77},
1408 {1, 0, 77}, {0, -1, 77}, {0, 1, 77}, {-1, 0, 78},
1409 {1, 0, 78}, {0, -1, 78}, {0, 1, 78}, {0, 0, 78}, {-1, 0, 79},
1410 {1, 0, 79}, {0, -1, 79}, {0, 1, 79}, {1, 0, 130},
1411 {0, 0, 130}, {1, 0, 146},
1414 for(
int x = 0; x < 25; x++)
1416 for(
int y = 0; y < 3; y++)
1424 {1, 0, 96}, {0, -1, 96}, {0, 1, 96}, {-1, 0, 76},
1425 {1, 0, 76}, {0, -1, 76}, {0, 1, 76}, {-1, 0, 77},
1426 {1, 0, 77}, {0, -1, 77}, {0, 1, 77}, {-1, 0, 78},
1427 {1, 0, 78}, {0, -1, 78}, {0, 1, 78}, {-1, 0, 79},
1428 {1, 0, 79}, {0, -1, 79}, {0, 1, 79}, {0, 1, 129},
1429 {0, -1, 129}, {1, 0, 130},
1430 {-1, 0, 130}, {0, 1, 145},
1431 {0, -1, 145}, {1, 0, 146},
1434 for(
int x = 0; x < 28; x++)
1436 for(
int y = 0; y < 3; y++)
1454 for(
int x = 0; x < 8; x++)
1456 for(
int y = 0; y < 3; y++)
1474 for(
int x = 0; x < 8; x++)
1476 for(
int y = 0; y < 3; y++)
1494 for(
int x = 0; x < 8; x++)
1496 for(
int y = 0; y < 3; y++)
1514 for(
int x = 0; x < 8; x++)
1516 for(
int y = 0; y < 3; y++)
1524 {1, 0, 131}, {0, -1, 131}, {0, 1, 131}};
1526 for(
int x = 0; x < 4; x++)
1528 for(
int y = 0; y < 3; y++)
1536 0, 1, 2, 5, 6, 3, 4, 9, 10, 7, 8, 13, 14, 11, 12, 15, 16, 17, 19, 18, 22, 23, 20, 21, 26, 27, 24, 25, 30, 31, 28, 29, 34, 35, 32, 33, 38, 39, 36, 37, 42,
1537 43, 40, 41, 45, 44, 47, 46, 48, 49, 51, 50, 53, 52, 55, 54, 57, 56, 59, 58, 60, 61, 63, 62, 66, 67, 64, 65, 68, 69, 71, 70, 74, 75, 72, 73, 77, 76, 78,
1538 79, 80, 81, 83, 82, 86, 87, 84, 85, 88, 89, 91, 90, 94, 95, 92, 93, 96, 99, 100, 97, 98, 103, 104, 101, 102, 106, 105, 109, 110, 107, 108, 113, 114,
1539 111, 112, 117, 118, 115, 116, 119, 120, 121, 123, 122, 124, 125, 126, 128, 127, 129, 130, 131, 134, 133, 132, 135, 139, 138, 137, 136, 143, 142, 141,
1545 0, 1, 2, 4, 3, 6, 5, 8, 7, 10, 9, 12, 11, 14, 13, 15, 16, 17, 19, 18, 21, 20, 23, 22, 25, 24, 27, 26, 29, 28, 31, 30, 33, 32, 35, 34, 37, 36, 39, 38, 41,
1546 40, 43, 42, 45, 44, 47, 46, 48, 49, 51, 50, 53, 52, 55, 54, 57, 56, 59, 58, 61, 60, 62, 63, 65, 64, 67, 66, 69, 68, 70, 71, 73, 72, 75, 74, 76, 77, 79,
1547 78, 81, 80, 82, 83, 85, 84, 87, 86, 89, 88, 90, 91, 93, 92, 95, 94, 96, 98, 97, 100, 99, 102, 101, 104, 103, 106, 105, 108, 107, 110, 109, 112, 111,
1548 114, 113, 116, 115, 118, 117, 119, 120, 124, 122, 123, 121, 126, 125, 127, 128, 129, 130, 131, 132, 135, 134, 133, 137, 136, 139, 138, 142, 143, 140,
1554 0, 2, 1, 4, 6, 3, 5, 14, 12, 13, 11, 7, 9, 8, 10, 15, 16, 17, 19, 18, 25, 27, 24, 26, 21, 23, 20, 22, 35, 33, 34, 32, 28, 30, 29, 31, 41, 43, 40, 42, 37,
1555 39, 36, 38, 46, 47, 44, 45, 49, 48, 51, 50, 56, 57, 58, 59, 52, 53, 54, 55, 63, 62, 60, 61, 65, 67, 64, 66, 71, 70, 68, 69, 73, 75, 72, 74, 79, 78, 76,
1556 77, 83, 82, 80, 81, 85, 87, 84, 86, 91, 90, 88, 89, 93, 95, 92, 94, 96, 102, 104, 101, 103, 98, 100, 97, 99, 106, 105, 108, 110, 107, 109, 116, 118,
1557 115, 117, 112, 114, 111, 113, 120, 119, 122, 124, 121, 123, 127, 128, 126, 125, 130, 129, 131, 133, 134, 135, 132, 137, 138, 139, 136, 143, 142, 140,
1563 0, 2, 1, 5, 3, 6, 4, 11, 13, 12, 14, 10, 8, 9, 7, 15, 16, 17, 19, 18, 26, 24, 27, 25, 22, 20, 23, 21, 32, 34, 33, 35, 31, 29, 30, 28, 42, 40, 43, 41, 38,
1564 36, 39, 37, 46, 47, 44, 45, 49, 48, 51, 50, 56, 57, 58, 59, 52, 53, 54, 55, 62, 63, 61, 60, 66, 64, 67, 65, 70, 71, 69, 68, 74, 72, 75, 73, 78, 79, 77,
1565 76, 82, 83, 81, 80, 86, 84, 87, 85, 90, 91, 89, 88, 94, 92, 95, 93, 96, 103, 101, 104, 102, 99, 97, 100, 98, 106, 105, 109, 107, 110, 108, 117, 115,
1566 118, 116, 113, 111, 114, 112, 120, 119, 123, 121, 124, 122, 128, 127, 125, 126, 130, 129, 131, 135, 132, 133, 134, 139, 136, 137, 138, 142, 143, 141,
1588 delete UGMIt->second;
1664 Simple,
Simple,
Simple,
Simple,
Simple,
Simple,
Simple,
Simple,
Simple,
Simple,
1665 Points,
Points,
Points,
Points,
Points,
Points,
Points,
Points,
Points,
Points,
Points,
Points,
Points,
Points,
Points,
Points,
1667 Bridge,
Bridge,
Bridge,
Bridge,
Bridge,
Bridge,
Bridge,
Bridge,
Bridge,
Bridge,
Bridge,
Bridge,
1674 Parapet,
Parapet,
Parapet,
Parapet,
Parapet,
Parapet,
Parapet,
Parapet,
Parapet,
Parapet,
Parapet,
Parapet,
Parapet,
Parapet,
Parapet,
Parapet,
Parapet,
1675 Parapet,
Parapet,
Parapet,
Parapet,
Parapet,
Parapet,
Parapet,
Parapet,
Parapet,
Parapet,
Parapet,
1688 {4, 6, -1, -1}, {2, 8, -1, -1}, {6, 8, -1, -1}, {4, 8, -1, -1}, {2, 6, -1, -1}, {2, 4, -1, -1},
1689 {4, 6, 4, 2}, {6, 4, 6, 2}, {4, 6, 4, 8}, {6, 4, 6, 8}, {8, 2, 8, 4}, {8, 2, 8, 6}, {2, 8, 2, 4}, {2, 8, 2, 6},
1691 {4, 6, 2, 8}, {1, 9, 3, 7},
1693 {3, 7, -1, -1}, {1, 9, -1, -1}, {7, 6, -1, -1}, {4, 9, -1, -1}, {1, 6, -1, -1}, {4, 3, -1, -1}, {3, 8, -1, -1}, {1, 8, -1, -1}, {2, 9, -1, -1},
1695 {4, 6, 4, 3}, {6, 4, 6, 1}, {4, 6, 4, 9}, {6, 4, 6, 7}, {8, 2, 8, 1}, {8, 2, 8, 3}, {2, 8, 2, 7}, {2, 8, 2, 9}, {9, 1, 9, 2}, {7, 3, 7, 2}, {3, 7, 3, 8}, {1, 9, 1, 8}, {9, 1, 9, 4}, {7, 3, 7, 6}, {3, 7, 3, 4}, {1, 9, 1, 6},
1698 {1, 9, 2, 8}, {2, 8, 3, 7}, {4, 6, 3, 7}, {1, 9, 4, 6},
1699 {2, 8, 4, 6}, {4, 6, 2, 8}, {3, 7, 1, 9}, {1, 9, 3, 7}, {2, 8, 1, 9}, {2, 8, 3, 7}, {3, 7, 2, 8}, {1, 9, 2, 8}, {4, 6, 3, 7}, {4, 6, 1, 9}, {1, 9, 4, 6}, {3, 7, 4, 6},
1700 {4, 6, -1, -1}, {6, 4, -1, -1}, {8, 2, -1, -1}, {2, 8, -1, -1}, {1, 9, -1, -1}, {3, 7, -1, -1}, {7, 3, -1, -1}, {9, 1, -1, -1},
1701 {4, 6, -1, -1}, {4, 6, -1, -1}, {2, 8, -1, -1}, {2, 8, -1, -1}, {1, 9, -1, -1}, {3, 7, -1, -1}, {3, 7, -1, -1}, {1, 9, -1, -1},
1702 {-1, -1, -1, -1}, {-1, -1, -1, -1}, {-1, -1, -1, -1}, {-1, -1, -1, -1},
1703 {4, 6, -1, -1}, {6, 4, -1, -1}, {8, 2, -1, -1}, {2, 8, -1, -1}, {1, 9, -1, -1}, {3, 7, -1, -1}, {7, 3, -1, -1}, {9, 1, -1, -1},
1704 {4, 6, -1, -1}, {6, 4, -1, -1}, {8, 2, -1, -1}, {2, 8, -1, -1}, {1, 9, -1, -1}, {3, 7, -1, -1}, {7, 3, -1, -1}, {9, 1, -1, -1},
1706 {-1, -1, -1, -1}, {-1, -1, -1, -1}, {-1, -1, -1, -1}, {-1, -1, -1, -1}, {-1, -1, -1, -1}, {-1, -1, -1, -1}, {-1, -1, -1, -1}, {-1, -1, -1, -1},
1707 {-1, -1, -1, -1}, {-1, -1, -1, -1}, {-1, -1, -1, -1}, {-1, -1, -1, -1}, {-1, -1, -1, -1}, {-1, -1, -1, -1}, {-1, -1, -1, -1}, {-1, -1, -1, -1},
1708 {-1, -1, -1, -1}, {-1, -1, -1, -1}, {-1, -1, -1, -1}, {-1, -1, -1, -1}, {-1, -1, -1, -1}, {-1, -1, -1, -1}, {-1, -1, -1, -1}, {-1, -1, -1, -1},
1709 {-1, -1, -1, -1}, {-1, -1, -1, -1}, {-1, -1, -1, -1}, {-1, -1, -1, -1},
1710 {4, 6, -1, -1}, {4, 6, -1, -1}, {2, 8, -1, -1}, {2, 8, -1, -1},
1711 {4, 6, -1, -1}, {2, 8, -1, -1},
1713 {8, 1, 8, 3}, {4, 3, 4, 9}, {2, 9, 2, 7}, {6, 7, 6, 1}, {9, 4, 9, 2}, {7, 2, 7, 6}, {1, 6, 1, 8}, {3, 8, 3, 4},
1715 {3, 7, -1, -1}, {3, 7, -1, -1}, {1, 9, -1, -1}, {1, 9, -1, -1},
1717 {4, 6, -1, -1}, {2, 8, -1, -1},
1722 {
Connection,
Connection,
NotSet,
NotSet}, {
Connection,
Connection,
NotSet,
NotSet}, {
Connection,
Connection,
NotSet,
NotSet},
1723 {
Connection,
Connection,
NotSet,
NotSet}, {
Connection,
Connection,
NotSet,
NotSet}, {
Connection,
Connection,
NotSet,
NotSet},
1724 {
Lead,
Trail,
Lead,
Trail}, {
Lead,
Trail,
Lead,
Trail}, {
Lead,
Trail,
Lead,
Trail}, {
Lead,
Trail,
Lead,
Trail}, {
Lead,
Trail,
Lead,
Trail},
1725 {
Lead,
Trail,
Lead,
Trail}, {
Lead,
Trail,
Lead,
Trail}, {
Lead,
Trail,
Lead,
Trail},
1728 {
Connection,
Connection,
NotSet,
NotSet}, {
Connection,
Connection,
NotSet,
NotSet}, {
Connection,
Connection,
NotSet,
NotSet},
1729 {
Connection,
Connection,
NotSet,
NotSet}, {
Connection,
Connection,
NotSet,
NotSet}, {
Connection,
Connection,
NotSet,
NotSet},
1730 {
Connection,
Connection,
NotSet,
NotSet}, {
Connection,
Connection,
NotSet,
NotSet}, {
Connection,
Connection,
NotSet,
NotSet},
1732 {
Lead,
Trail,
Lead,
Trail}, {
Lead,
Trail,
Lead,
Trail}, {
Lead,
Trail,
Lead,
Trail}, {
Lead,
Trail,
Lead,
Trail}, {
Lead,
Trail,
Lead,
Trail},
1733 {
Lead,
Trail,
Lead,
Trail}, {
Lead,
Trail,
Lead,
Trail}, {
Lead,
Trail,
Lead,
Trail}, {
Lead,
Trail,
Lead,
Trail}, {
Lead,
Trail,
Lead,
Trail},
1734 {
Lead,
Trail,
Lead,
Trail}, {
Lead,
Trail,
Lead,
Trail}, {
Lead,
Trail,
Lead,
Trail}, {
Lead,
Trail,
Lead,
Trail}, {
Lead,
Trail,
Lead,
Trail},
1736 {
CrossConn,
CrossConn,
CrossConn,
CrossConn}, {
CrossConn,
CrossConn,
CrossConn,
CrossConn}, {
CrossConn,
CrossConn,
CrossConn,
CrossConn},
1738 {
Connection,
Connection,
Under,
Under}, {
Connection,
Connection,
Under,
Under}, {
Connection,
Connection,
Under,
Under},
1739 {
Connection,
Connection,
Under,
Under}, {
Connection,
Connection,
Under,
Under}, {
Connection,
Connection,
Under,
Under},
1740 {
Connection,
Connection,
Under,
Under}, {
Connection,
Connection,
Under,
Under}, {
Connection,
Connection,
Under,
Under},
1741 {
Connection,
Connection,
Under,
Under}, {
Connection,
Connection,
Under,
Under}, {
Connection,
Connection,
Under,
Under},
1742 {
End,
Connection,
NotSet,
NotSet}, {
End,
Connection,
NotSet,
NotSet}, {
End,
Connection,
NotSet,
NotSet}, {
End,
Connection,
NotSet,
NotSet},
1743 {
End,
Connection,
NotSet,
NotSet}, {
End,
Connection,
NotSet,
NotSet}, {
End,
Connection,
NotSet,
NotSet}, {
End,
Connection,
NotSet,
NotSet},
1744 {
Connection,
Signal,
NotSet,
NotSet}, {
Signal,
Connection,
NotSet,
NotSet}, {
Signal,
Connection,
NotSet,
NotSet}, {
Connection,
Signal,
NotSet,
NotSet},
1745 {
Signal,
Connection,
NotSet,
NotSet}, {
Signal,
Connection,
NotSet,
NotSet}, {
Connection,
Signal,
NotSet,
NotSet}, {
Connection,
Signal,
NotSet,
NotSet},
1746 {
NotSet,
NotSet,
NotSet,
NotSet}, {
NotSet,
NotSet,
NotSet,
NotSet}, {
NotSet,
NotSet,
NotSet,
NotSet}, {
NotSet,
NotSet,
NotSet,
NotSet},
1747 {
End,
Connection,
NotSet,
NotSet}, {
End,
Connection,
NotSet,
NotSet}, {
End,
Connection,
NotSet,
NotSet}, {
End,
Connection,
NotSet,
NotSet},
1748 {
End,
Connection,
NotSet,
NotSet}, {
End,
Connection,
NotSet,
NotSet}, {
End,
Connection,
NotSet,
NotSet}, {
End,
Connection,
NotSet,
NotSet},
1749 {
Gap,
Connection,
NotSet,
NotSet}, {
Gap,
Connection,
NotSet,
NotSet}, {
Gap,
Connection,
NotSet,
NotSet}, {
Gap,
Connection,
NotSet,
NotSet},
1750 {
Gap,
Connection,
NotSet,
NotSet}, {
Gap,
Connection,
NotSet,
NotSet}, {
Gap,
Connection,
NotSet,
NotSet}, {
Gap,
Connection,
NotSet,
NotSet},
1752 {
NotSet,
NotSet,
NotSet,
NotSet}, {
NotSet,
NotSet,
NotSet,
NotSet}, {
NotSet,
NotSet,
NotSet,
NotSet}, {
NotSet,
NotSet,
NotSet,
NotSet},
1753 {
NotSet,
NotSet,
NotSet,
NotSet}, {
NotSet,
NotSet,
NotSet,
NotSet}, {
NotSet,
NotSet,
NotSet,
NotSet}, {
NotSet,
NotSet,
NotSet,
NotSet},
1754 {
NotSet,
NotSet,
NotSet,
NotSet}, {
NotSet,
NotSet,
NotSet,
NotSet}, {
NotSet,
NotSet,
NotSet,
NotSet}, {
NotSet,
NotSet,
NotSet,
NotSet},
1755 {
NotSet,
NotSet,
NotSet,
NotSet}, {
NotSet,
NotSet,
NotSet,
NotSet}, {
NotSet,
NotSet,
NotSet,
NotSet}, {
NotSet,
NotSet,
NotSet,
NotSet},
1756 {
NotSet,
NotSet,
NotSet,
NotSet}, {
NotSet,
NotSet,
NotSet,
NotSet}, {
NotSet,
NotSet,
NotSet,
NotSet}, {
NotSet,
NotSet,
NotSet,
NotSet},
1757 {
NotSet,
NotSet,
NotSet,
NotSet}, {
NotSet,
NotSet,
NotSet,
NotSet}, {
NotSet,
NotSet,
NotSet,
NotSet}, {
NotSet,
NotSet,
NotSet,
NotSet},
1758 {
NotSet,
NotSet,
NotSet,
NotSet}, {
NotSet,
NotSet,
NotSet,
NotSet}, {
NotSet,
NotSet,
NotSet,
NotSet}, {
NotSet,
NotSet,
NotSet,
NotSet},
1759 {
Connection,
Connection,
NotSet,
NotSet}, {
Connection,
Connection,
NotSet,
NotSet}, {
Connection,
Connection,
NotSet,
NotSet},
1763 {
Lead,
Trail,
Lead,
Trail}, {
Lead,
Trail,
Lead,
Trail}, {
Lead,
Trail,
Lead,
Trail}, {
Lead,
Trail,
Lead,
Trail}, {
Lead,
Trail,
Lead,
Trail},
1764 {
Lead,
Trail,
Lead,
Trail}, {
Lead,
Trail,
Lead,
Trail}, {
Lead,
Trail,
Lead,
Trail},
1765 {
Connection,
Connection,
NotSet,
NotSet}, {
Connection,
Connection,
NotSet,
NotSet}, {
Connection,
Connection,
NotSet,
NotSet},
1771 for(
int x = 0; x < 17; x++)
1773 FixedTrackPiece[x] =
TFixedTrackPiece(x, TrackTypeArray[x], Links[x], Configs[x], TrackImageArray[x], SmallTrackImageArray[x]);
1775 FixedTrackPiece[17] =
TFixedTrackPiece(17, TrackTypeArray[17], Links[17], Configs[17], 0, 0);
1779 FixedTrackPiece[x] =
TFixedTrackPiece(x, TrackTypeArray[x], Links[x], Configs[x], TrackImageArray[x], SmallTrackImageArray[x]);
1785 ExistingGraphicLoaded(false), Width(16), Height(16)
1797 ExistingGraphicLoaded(false), Width(WidthIn), Height(HeightIn)
1835 throw Exception(
"Overlay not loaded in TGraphicElement::LoadOriginalScreenGraphic()");
1839 throw Exception(
"Overlay not 16x16 in TGraphicElement::LoadOriginalScreenGraphic()");
1843 throw Exception(
"Source not set in TGraphicElement::LoadOriginalScreenGraphic()");
1847 throw Exception(
"ExistingGraphicLoaded in TGraphicElement::LoadOriginalScreenGraphic()");
1870 AnsiString(VOffset) +
"," + AnsiString(WidthIn) +
"," + AnsiString(HeightIn));
1873 throw Exception(
"Overlay not loaded in TGraphicElement::LoadOriginalExistingGraphic()");
1877 throw Exception(
"Source not set in TGraphicElement::LoadOriginalExistingGraphic()");
1881 throw Exception(
"ScreenGraphicLoaded in TGraphicElement::LoadOriginalExistingGraphic()");
1915 throw Exception(
"Overlay not loaded in TGraphicElement::PlotOverlay()");
1936 throw Exception(
"Original not loaded in TGraphicElement::PlotOriginal()");
1950 bool TrackPresent =
false;
1964 for(
unsigned int x = 0; x <
TrackVector.size(); x++)
1968 TrackPresent =
true;
1973 return(!TrackPresent);
1981 bool TrackPresent =
false;
1990 for(
unsigned int x = 0; x <
TrackVector.size(); x++)
1994 TrackPresent =
true;
2000 return(!TrackPresent);
2005 void TTrack::EraseTrackElement(
int Caller,
int HLocInput,
int VLocInput,
int &ErasedTrackVectorPosition,
bool &TrackEraseSuccessfulFlag,
bool InternalChecks)
2008 AnsiString(VLocInput) +
"," + AnsiString((
short)InternalChecks));
2009 TrackEraseSuccessfulFlag =
false;
2014 ErasedTrackVectorPosition = -1;
2015 AnsiString SName =
"", ErrorString;
2017 THVPair TrackMapKeyPair, InactiveTrackMapKeyPair;
2023 TrackMapKeyPair.first = HLocInput;
2024 TrackMapKeyPair.second = VLocInput;
2025 TrackMapPtr =
TrackMap.find(TrackMapKeyPair);
2036 if(ErrorString !=
"")
2038 throw Exception(ErrorString +
" for EraseTrackElement 1");
2062 ErasedTrackVectorPosition = VecPos;
2063 TrackEraseSuccessfulFlag =
true;
2069 unsigned int VecPos;
2070 InactiveTrackMapKeyPair.first = HLocInput;
2071 InactiveTrackMapKeyPair.second = VLocInput;
2076 VecPos = InactiveTrack2MultiMapIterator->second;
2081 if(ErrorString !=
"")
2083 throw Exception(ErrorString +
" for EraseTrackElement 2A");
2093 TrackEraseSuccessfulFlag =
true;
2114 VecPos = InactiveTrack2MultiMapIterator->second;
2119 if(ErrorString !=
"")
2121 throw Exception(ErrorString +
" for EraseTrackElement 2B");
2145 if(TrackEraseSuccessfulFlag)
2161 void TTrack::PlotAndAddTrackElement(
int Caller,
int CurrentTag,
int Aspect,
int HLocInput,
int VLocInput,
bool &TrackLinkingRequiredFlag,
bool InternalChecks,
bool PerformNameSearch)
2168 AnsiString(HLocInput) +
"," + AnsiString(VLocInput) +
"," + AnsiString((
short)InternalChecks));
2169 bool PlatAllowedFlag =
false;
2171 TrackLinkingRequiredFlag =
false;
2183 LocationNameEntry.first =
"";
2191 TempTrackElement.
HLoc = HLocInput;
2192 TempTrackElement.
VLoc = VLocInput;
2218 else if(Aspect == 1)
2222 else if(Aspect == 2)
2226 else if(Aspect == 3)
2235 bool FoundFlag =
false, InactiveFoundFlag =
false, NonStationOrLevelCrossingPresent =
false, PlatformPresent =
false;
2238 int InactiveSpeedTag1 = 0, InactiveSpeedTag2 = 0;
2240 if(InactiveFoundFlag)
2244 NonStationOrLevelCrossingPresent =
true;
2248 NonStationOrLevelCrossingPresent =
true;
2252 PlatformPresent =
true;
2263 if(InactiveFoundFlag && ((TempTrackElement.
SpeedTag == InactiveSpeedTag1) || (TempTrackElement.
SpeedTag == InactiveSpeedTag2)))
2271 PlatAllowedFlag =
true;
2275 PlatAllowedFlag =
true;
2279 PlatAllowedFlag =
true;
2283 PlatAllowedFlag =
true;
2287 TrackLinkingRequiredFlag =
true;
2289 if(PerformNameSearch)
2318 if((FoundFlag && (
NameAllowed.Contains(
TrackElementAt(1048, VecPos).SpeedTag)) && !PlatformPresent && !InactiveFoundFlag) ||
2319 (!FoundFlag && !InactiveFoundFlag))
2322 TrackLinkingRequiredFlag =
true;
2324 if(PerformNameSearch)
2357 TrackLinkingRequiredFlag =
true;
2369 else if(FoundFlag || InactiveFoundFlag)
2382 if(PerformNameSearch)
2391 bool BothPointFillets =
true;
2406 TrackLinkingRequiredFlag =
true;
2408 if(InternalChecks && PerformNameSearch)
2420 bool InternalChecks)
2424 AnsiString(VLocInput) +
"," + AnsiString((
short)InternalChecks));
2425 bool PlatAllowedFlag =
false;
2427 TrackLinkingRequiredFlag =
false;
2430 LocationNameEntry.first =
"";
2436 TempTrackElement.
HLoc = HLocInput;
2437 TempTrackElement.
VLoc = VLocInput;
2438 bool FoundFlag =
false, InactiveFoundFlag =
false, NonStationOrLevelCrossingPresent =
false, PlatformPresent =
false;
2439 for(
int x = 0; x < 4; x++)
2445 TempTrackElement.
Conn[x] = -1;
2459 int InactiveSpeedTag1 = 0, InactiveSpeedTag2 = 0;
2461 if(InactiveFoundFlag)
2465 NonStationOrLevelCrossingPresent =
true;
2469 NonStationOrLevelCrossingPresent =
true;
2473 PlatformPresent =
true;
2484 if(InactiveFoundFlag && ((TempTrackElement.
SpeedTag == InactiveSpeedTag1) || (TempTrackElement.
SpeedTag == InactiveSpeedTag2)))
2492 PlatAllowedFlag =
true;
2496 PlatAllowedFlag =
true;
2500 PlatAllowedFlag =
true;
2504 PlatAllowedFlag =
true;
2508 TrackLinkingRequiredFlag =
true;
2539 if((FoundFlag && (
NameAllowed.Contains(
TrackElementAt(1055, VecPos).SpeedTag)) && !PlatformPresent && !InactiveFoundFlag) ||
2540 (!FoundFlag && !InactiveFoundFlag))
2543 TrackLinkingRequiredFlag =
true;
2580 TrackLinkingRequiredFlag =
true;
2592 else if(FoundFlag || InactiveFoundFlag)
2611 bool BothPointFillets =
true;
2626 TrackLinkingRequiredFlag =
true;
2656 ShowMessage(
"Gaps must be set before track can be validated");
2666 throw Exception(
"Error, gaps unset when TryToConnectTrack called");
2677 if(!
LinkTrack(1, LocError, HLoc, VLoc,
false))
2694 ShowMessage(
"Error in RepositionAndMapTrack during TryToConnectTrack. Railway file is corrupt, further use may cause a system crash");
2701 if(!
LinkTrack(2, LocError, HLoc, VLoc,
true))
2725 std::pair<AnsiString, char>TempMapPair;
2733 TempMapPair.second =
'x';
2743 AnsiString Name =
"";
2744 typedef std::list<AnsiString> TNoPlatsList;
2745 TNoPlatsList::iterator NPLIt;
2746 TNoPlatsList NoPlatsList;
2747 typedef std::list<AnsiString> TLocNameList;
2748 TLocNameList LocNameList;
2753 LocNameList.push_back(LNMMIt->first);
2756 LocNameList.unique();
2757 for(TLocNameList::iterator LNLIt = LocNameList.begin(); LNLIt != LocNameList.end(); LNLIt++)
2761 if(MMRange.first == MMRange.second)
2767 if((LNMMIt->second) < 0)
2781 TempIt = MMRange.second;
2782 if(LNMMIt == --TempIt)
2784 NoPlatsList.push_back(Name);
2788 if(!NoPlatsList.empty())
2790 AnsiString NoPlatsAnsiList =
"";
2791 for(NPLIt = NoPlatsList.begin(); NPLIt != NoPlatsList.end(); NPLIt++)
2793 NoPlatsAnsiList += *NPLIt +
'\n';
2797 if(NoPlatsList.size() > 1)
2799 ShowMessage(
"Please note: the following locations have no platforms, trains won't be able to stop or pass there:-\n\n" + NoPlatsAnsiList +
"\nThis message will not be shown again.");
2803 ShowMessage(
"Please note: the following location has no platforms, trains won't be able to stop or pass there:-\n\n" + NoPlatsAnsiList +
"\nThis message will not be shown again.");
2818 int NewHLoc, NewVLoc;
2819 bool ConnectionFoundFlag, LinkFoundFlag;
2821 for(
unsigned int x = 0; x <
TrackVector.size(); x++)
2823 for(
unsigned int y = 0; y < 4; y++)
2841 ConnectionFoundFlag =
false;
2842 for(
unsigned int z = 0; z <
TrackVector.size(); z++)
2848 ConnectionFoundFlag =
true;
2850 LinkFoundFlag =
false;
2851 for(
unsigned int a = 0; a < 4; a++)
2855 LinkFoundFlag =
true;
2871 if(!ConnectionFoundFlag)
2946 for(
unsigned int x = 0; x <
TrackVector.size(); x++)
2963 bool UnsetGaps =
false;
2970 for(
unsigned int x = 0; x <
TrackVector.size(); x++)
2974 for(
unsigned int y = 0; y < 4; y++)
2986 for(
unsigned int y = 0; y < 4; y++)
2996 for(
unsigned int y = 1; y < 4; y++)
3005 for(
unsigned int y = 0; y < 4; y++)
3018 for(
unsigned int y = 0; y < 4; y++)
3046 int NumberOfActiveElements = 0;
3048 GraphicsFollow =
false;
3052 if(MarkerString[MarkerString.Length()] ==
'1')
3054 GraphicsFollow =
true;
3056 for(
int x = 0; x < NumberOfActiveElements; x++)
3062 TrackElement.
HLoc = TempInt;
3064 TrackElement.
VLoc = TempInt;
3070 TrackElement.
Conn[0] = TempInt;
3094 if((TempInt != -1) && (TempInt < 10))
3104 if((TempInt != -1) && (TempInt < 10))
3121 if(Marker[1] ==
'3')
3125 else if(Marker[1] ==
'2')
3129 else if(Marker[1] ==
'G')
3143 int NumberOfInactiveElements = 0;
3147 for(
int x = 0; x < NumberOfInactiveElements; x++)
3153 TrackElement.
HLoc = TempInt;
3155 TrackElement.
VLoc = TempInt;
3161 bool LocError =
false;
3190 for(
int x = 0; x < NumberOfGraphics; x++)
3201 bool FileError =
false;
3203 for(
int x = 0; x < NumberOfGraphics; x++)
3216 UGME.second =
new TPicture;
3217 UGME.second->LoadFromFile(
UGME.first);
3220 throw Exception(
"Map Insertion Error 2 - UserGraphicMap insertion failure for " + UGI.
FileName);
3227 catch(
const EInvalidGraphic &e)
3236 delete UGMIt->second;
3241 catch(
const Exception &e)
3250 delete UGMIt->second;
3258 bool FoundInMap =
false;
3277 UGME.second =
new TPicture;
3278 UGME.second->LoadFromFile(
UGME.first);
3281 throw Exception(
"Map Insertion Error 3 - UserGraphicMap insertion failure for " + UGI.
FileName);
3288 catch(
const EInvalidGraphic &e)
3297 delete UGMIt->second;
3302 catch(
const Exception &e)
3311 delete UGMIt->second;
3336 VecFile <<
"**Active elements**1" <<
'\0' <<
'\n';
3340 VecFile <<
"**Active elements**" <<
'\0' <<
'\n';
3342 for(
unsigned int x = 0; x < (
TrackVector.size()); x++)
3345 VecFile << x <<
'\n';
3346 VecFile << TrackElement.
SpeedTag <<
'\n';
3347 VecFile << TrackElement.
HLoc <<
'\n';
3348 VecFile << TrackElement.
VLoc <<
'\n';
3352 VecFile << TrackElement.
Conn[0] <<
'\n';
3356 VecFile << TrackElement.
Attribute <<
'\n';
3362 VecFile << int(1) <<
'\n';
3366 VecFile << int(0) <<
'\n';
3369 VecFile << TrackElement.
Length01 <<
'\n';
3370 VecFile << TrackElement.
Length23 <<
'\n';
3373 VecFile << TrackElement.
LocationName.c_str() <<
'\0' <<
'\n';
3380 VecFile <<
"3*****" <<
'\0' <<
'\n';
3384 VecFile <<
"2*****" <<
'\0' <<
'\n';
3388 VecFile <<
"G*****" <<
'\0' <<
'\n';
3392 VecFile <<
"4*****" <<
'\0' <<
'\n';
3397 VecFile <<
"******" <<
'\0' <<
'\n';
3402 VecFile <<
"**Inactive elements**" <<
'\0' <<
'\n';
3406 VecFile << x <<
'\n';
3407 VecFile << InactiveTrackElement.
SpeedTag <<
'\n';
3408 VecFile << InactiveTrackElement.
HLoc <<
'\n';
3409 VecFile << InactiveTrackElement.
VLoc <<
'\n';
3410 VecFile << InactiveTrackElement.
LocationName.c_str() <<
'\0' <<
'\n';
3411 VecFile <<
"******" <<
'\0' <<
'\n';
3426 GraphicsFollow =
false;
3428 if((NumberOfActiveElements < 0) || (NumberOfActiveElements > 1000000))
3434 AnsiString MarkerString;
3441 if(MarkerString[MarkerString.Length()] ==
'1')
3443 GraphicsFollow =
true;
3445 for(
int x = 0; x < NumberOfActiveElements; x++)
3453 int SpeedTag = TempInt;
3460 if(((TempInt > 999999) || (TempInt < -1000001)) && (TempInt != -2000000000))
3466 if(((TempInt > 999999) || (TempInt < -1000001)) && (TempInt != -2000000000))
3471 if((SpeedTag > 87) && (SpeedTag < 96))
3474 if((TempInt < -1) || (TempInt > 3))
3480 if((TempInt < -1) || (TempInt > 999999))
3486 if(((SpeedTag >= 7) && (SpeedTag <= 14)) || ((SpeedTag >= 28) && (SpeedTag <= 43)) || ((SpeedTag >= 132) && (SpeedTag <= 139)) ||
3487 ((SpeedTag >= 68) && (SpeedTag <= 75)))
3490 if((TempInt < -1) || (TempInt > 5))
3496 if((SpeedTag >= 68) && (SpeedTag <= 75))
3499 if((TempInt != 0) && (TempInt != 1))
3506 if((TempInt < -1) || (TempInt > 999999))
3512 if((TempInt < -1) || (TempInt > 999999))
3518 if((TempInt < -1) || (TempInt > 999999))
3524 if((TempInt < -1) || (TempInt > 999999))
3545 int NumberOfInactiveElements = 0;
3548 if(NumberOfInactiveElements < 0)
3558 for(
int x = 0; x < NumberOfInactiveElements; x++)
3572 if(((TempInt > 999999) || (TempInt < -1000001)) && (TempInt != -2000000000))
3578 if(((TempInt > 999999) || (TempInt < -1000001)) && (TempInt != -2000000000))
3605 if((NumberOfGraphics < 0) || (NumberOfGraphics > 100000))
3611 AnsiString FileName =
"", TempStr =
"";
3613 for(
int x = 0; x < NumberOfGraphics; x++)
3615 TPicture *TempPicture =
new TPicture;
3624 TempPicture->LoadFromFile(GraphicsPath +
"\\" + FileName);
3637 catch(
const EInvalidGraphic &e)
3642 for(
int y = x + 1; y < NumberOfGraphics; y++)
3648 ShowMessage(FileName +
3649 " has an incorrect file format, user graphics can't be loaded. Ensure that all user graphic files are valid with extension .bmp, .gif, .jpg, or .png");
3654 catch(
const Exception &e)
3659 for(
int y = x + 1; y < NumberOfGraphics; y++)
3665 ShowMessage(
"Unable to load user graphic files, ensure that " + FileName +
3666 " exists in the 'Graphics' folder and that it is has extension .bmp, .gif, .jpg, or .png.");
3684 for(
int x = 0; x < VecSize; x++)
3707 for(
int x = 0; x < VecSize; x++)
3729 for(
int x = 0; x < VecSize; x++)
3783 for(
int x = 0; x < VecSize; x++)
3840 PlotPoints(5, Next, Disp, BothPointFilletsAndBasicLCs);
3892 if(BothPointFilletsAndBasicLCs)
3969 Bitmap->Canvas->CopyMode = cmSrcCopy;
3971 Graphics::TBitmap *GraphicOutput;
4146 for(
int x = 0; x < 40; x++)
4175 Graphics::TBitmap *GraphicPtr;
4190 Graphics::TBitmap* SignalPlatformGraphic;
4223 if(OldTransparentColour !=
clB5G5R5)
4246 Bitmap->Canvas->CopyMode = cmSrcCopy;
4274 Bitmap->Canvas->CopyMode = cmSrcCopy;
4276 Graphics::TBitmap *GraphicOutput;
4286 if(BaseElement == 1)
4382 for(
int x = 0; x < 40; x++)
4411 Graphics::TBitmap *GraphicPtr;
4426 Graphics::TBitmap* SignalPlatformGraphic;
4489 for(
int x = 0; x < 40; x++)
4497 Graphics::TBitmap* SignalPlatformGraphic;
4538 if(OldTransparentColour !=
clB5G5R5)
4552 for(
unsigned int x = 0; x <
TrackVector.size(); x++)
4624 for(
unsigned int x = 0; x <
TrackVector.size(); x++)
4638 ShowMessage(
"Error - gap connected to a non-gap. Railway file is corrupt, further use may cause a system crash");
4664 for(
unsigned int x = 0; x <
TrackVector.size(); x++)
4689 for(
unsigned int x = 0; x <
TrackVector.size(); x++)
4719 for(
unsigned int x = 0; x <
TrackVector.size(); x++)
4753 for(
unsigned int x = 0; x <
TrackVector.size(); x++)
4790 for(
unsigned int x = 0; x <
TrackVector.size(); x++)
4808 for(
unsigned int x = 0; x <
TrackVector.size(); x++)
4829 for(
unsigned int x = 0; x <
TrackVector.size(); x++)
4861 for(TrackMapPtr =
TrackMap.begin(); TrackMapPtr !=
TrackMap.end(); TrackMapPtr++)
4868 throw Exception(
"Error - Map & Vector different sizes");
4870 unsigned int NonZeroCount = 0;
4872 for(
unsigned int x = 0; x <
TrackVector.size(); x++)
4881 throw Exception(
"Error - NewVector & NonZero TrackVector different sizes");
4887 for(
unsigned int x = 0; x <
TrackVector.size(); x++)
4891 TrackMapEntry.first = TrackMapKeyPair;
4892 TrackMapEntry.second = x;
4893 if(!(
TrackMap.insert(TrackMapEntry).second))
4895 throw Exception(
"Error - map insertion failure, TrackVector in error");
4899 for(
unsigned int x = 0; x <
TrackVector.size(); x++)
4901 for(
unsigned int y = 0; y < 4; y++)
4926 THVPair GapMapKeyPair, GapMapValuePair;
4929 for(
unsigned int x = 0; x <
TrackVector.size(); x++)
4935 GapMapEntry.first = GapMapKeyPair;
4938 throw Exception(
"Error - Gap connection == -1 Can't build GapMap");
4942 GapMapEntry.second = GapMapValuePair;
4945 GapMap.insert(GapMapEntry);
4960 bool TrackElementPositionsOK =
true;
4962 for(
unsigned int x = 0; x <
TrackVector.size(); x++)
4974 "Footbridge or underpass connection error. Each end must connect to a platform, concourse "
4975 "or other footbridge or underpass, and they can't connect to each other (i.e. a footbridge "
4976 "can't connect to an underpass or vice versa)");
4984 for(
unsigned int y = 0; y < 4; y++)
5002 bool ConnectionFoundFlag;
5006 ShowMessage(
"Can't have a track element adjacent to a continuation exit");
5012 throw Exception(
"Error in final track linkage - continuation adjacent to another element");
5021 if(ConnectionFoundFlag)
5026 bool ExitSignal =
false;
5037 ShowMessage(
"Can't have an exit signal next to a level crossing - it can cause the train to foul the crossing in some circumstances");
5039 TrackElementPositionsOK =
false;
5044 ShowMessage(
"Can't have points, crossover or signal next to buffers - need room for a train without fouling");
5046 TrackElementPositionsOK =
false;
5051 ShowMessage(
"Can't have points, crossover, bridge or signal next to a continuation - it can cause route setting problems");
5055 TrackElementPositionsOK =
false;
5060 ShowMessage(
"Can't have two same-direction signals adjacent to each other as there is no room for a train between them");
5063 TrackElementPositionsOK =
false;
5075 ShowMessage(
"Bridge next to a signal - routes can't be truncated to this or other such signals.\n\nThis restriction can be removed or reinstated by pressing\nCTRL ALT 5. When removed this message will not be shown again.");
5078 TrackElementPositionsOK =
false;
5083 ShowMessage(
"Can't have two level crossings adjacent to each other on the same track");
5084 TrackElementPositionsOK =
false;
5087 if(!TrackElementPositionsOK)
5094 throw Exception(
"Error in track element positions in FinalCall");
5107 for(
unsigned int x = 0; x <
TrackVector.size(); x++)
5113 for(
unsigned int y = 0; y < 4; y++)
5135 bool ConnectionFoundFlag;
5136 bool LinkMatchFound =
false;
5139 if(ConnectionFoundFlag)
5141 for(
unsigned int a = 0; a < 4; a++)
5147 LinkMatchFound =
true;
5158 throw Exception(
"Error in final track linkage - - no matching link found");
5171 throw Exception(
"Error in final track linkage - connection not found");
5187 bool ConnErrorFlag =
false;
5189 for(
unsigned int x = 0; x <
TrackVector.size(); x++)
5193 ConnErrorFlag =
true;
5197 ConnErrorFlag =
true;
5201 ConnErrorFlag =
true;
5205 ConnErrorFlag =
true;
5214 throw Exception(
"Error, StationEntryStopLinkPos not -1 for unnamed element at TrackVectorPosition = " + AnsiString(x));
5223 throw Exception(
"ConnError in LinkTrack - Final");
5227 throw Exception(
"ConnError in LinkTrack - Precheck");
5230 bool CLkErrorFlag =
false;
5232 for(
unsigned int x = 0; x <
TrackVector.size(); x++)
5236 CLkErrorFlag =
true;
5240 CLkErrorFlag =
true;
5244 CLkErrorFlag =
true;
5248 CLkErrorFlag =
true;
5256 throw Exception(
"CLkError in LinkTrack - Final");
5260 throw Exception(
"CLkError in LinkTrack - Precheck");
5265 for(
unsigned int x = 0; x <
TrackVector.size(); x++)
5295 for(
unsigned int x = 0; x <
TrackVector.size(); x++)
5311 for(
unsigned int y = 0; y < 4; y++)
5330 bool ConnectionFoundFlag;
5336 throw Exception(
"Error in final track linkage - continuation adjacent to another element");
5345 if(ConnectionFoundFlag)
5348 bool LinkFoundFlag =
false;
5405 for(
unsigned int a = 0; a < 4; a++)
5414 LinkFoundFlag =
true;
5422 throw Exception(
"Error in final track linkage in LinkTrackNoMessages - invalid link");
5432 throw Exception(
"Error in final track linkage in LinkTrackNoMessages - connection not found");
5446 bool ConnErrorFlag =
false;
5448 for(
unsigned int x = 0; x <
TrackVector.size(); x++)
5452 ConnErrorFlag =
true;
5456 ConnErrorFlag =
true;
5460 ConnErrorFlag =
true;
5464 ConnErrorFlag =
true;
5473 throw Exception(
"Error, StationEntryStopLinkPos not -1 for unnamed element at TrackVectorPosition = " + AnsiString(x));
5482 throw Exception(
"ConnError in LinkTrack - Final");
5486 throw Exception(
"ConnError in LinkTrack - Precheck");
5489 bool CLkErrorFlag =
false;
5491 for(
unsigned int x = 0; x <
TrackVector.size(); x++)
5495 CLkErrorFlag =
true;
5499 CLkErrorFlag =
true;
5503 CLkErrorFlag =
true;
5507 CLkErrorFlag =
true;
5515 throw Exception(
"CLkError in LinkTrack - Final");
5519 throw Exception(
"CLkError in LinkTrack - Precheck");
5523 for(
unsigned int x = 0; x <
TrackVector.size(); x++)
5552 for(
unsigned int x = 0; x <
TrackVector.size(); x++)
5568 for(
unsigned int y = 0; y < 4; y++)
5587 bool ConnectionFoundFlag =
false;
5589 if(ConnectionFoundFlag)
5593 bool LinkFoundFlag =
false;
5613 for(
unsigned int a = 0; a < 4; a++)
5622 LinkFoundFlag =
true;
5642 bool ConnErrorFlag =
false;
5644 for(
unsigned int x = 0; x <
TrackVector.size(); x++)
5648 ConnErrorFlag =
true;
5652 ConnErrorFlag =
true;
5656 ConnErrorFlag =
true;
5660 ConnErrorFlag =
true;
5668 bool CLkErrorFlag =
false;
5670 for(
unsigned int x = 0; x <
TrackVector.size(); x++)
5674 CLkErrorFlag =
true;
5678 CLkErrorFlag =
true;
5682 CLkErrorFlag =
true;
5686 CLkErrorFlag =
true;
5704 int Position1, Position2;
5710 for(GapMapPtr =
GapMap.begin(); GapMapPtr !=
GapMap.end(); GapMapPtr++)
5712 int HLoc1 = GapMapPtr->first.first;
5713 int VLoc1 = GapMapPtr->first.second;
5714 int HLoc2 = GapMapPtr->second.first;
5715 int VLoc2 = GapMapPtr->second.second;
5718 throw Exception(
"Failed to find H & V for gap1, GapMap in error");
5722 throw Exception(
"Failed to find H & V for gap2, GapMap in error");
5726 throw Exception(
"Element at Pos1 not a gap, GapMap in error");
5730 throw Exception(
"Element at Pos2 not a gap, GapMap in error");
5748 AnsiString(TrackElement.
VLoc) +
"," + AnsiString(TrackElement.
SpeedTag));
5749 THVPair TrackMapKeyPair, InactiveTrackMapKeyPair;
5759 bool FoundFlag =
false;
5771 InactiveTrackMapKeyPair.first = TrackElement.
HLoc;
5772 InactiveTrackMapKeyPair.second = TrackElement.
VLoc;
5773 InactiveTrackMapEntry.first = InactiveTrackMapKeyPair;
5802 bool FoundFlag =
false;
5815 TrackMapKeyPair.first = TrackElement.
HLoc;
5816 TrackMapKeyPair.second = TrackElement.
VLoc;
5817 TrackMapEntry.first = TrackMapKeyPair;
5822 LocationNameEntry.second = -(int)(
TrackVector.size());
5862 TrackMapKeyPair.first = HLoc;
5863 TrackMapKeyPair.second = VLoc;
5864 TrackMapPtr =
TrackMap.find(TrackMapKeyPair);
5874 return(TrackMapPtr->second);
5887 TrackMapKeyPair.first = HLoc;
5888 TrackMapKeyPair.second = VLoc;
5889 TrackMapPtr =
TrackMap.find(TrackMapKeyPair);
5892 AnsiString Message =
"Element not found at HLoc " + AnsiString(HLoc) +
" and VLoc " + AnsiString(VLoc);
5893 throw Exception(Message);
5911 MapKeyPair.first = HLoc;
5912 MapKeyPair.second = VLoc;
5913 MapPtr = Map.find(MapKeyPair);
5914 if(MapPtr == Map.end())
5916 AnsiString Message =
"Element not found at HLoc " + AnsiString(HLoc) +
" and VLoc " + AnsiString(VLoc) +
" in GetTrackElementFromAnyTrackMap";
5917 throw Exception(Message);
5922 return(Vector.at(MapPtr->second));
5932 THVPair InactiveTrackMapKeyPair;
5935 InactiveTrackMapKeyPair.first = HLoc;
5936 InactiveTrackMapKeyPair.second = VLoc;
5940 AnsiString Message =
"Inactive element not found at HLoc " + AnsiString(HLoc) +
" and VLoc " + AnsiString(VLoc);
5941 throw Exception(Message);
5955 bool Present =
true;
5959 TrackMapKeyPair.first = HLoc;
5960 TrackMapKeyPair.second = VLoc;
5961 TrackMapPtr =
TrackMap.find(TrackMapKeyPair);
5976 bool Present =
true;
5977 THVPair InactiveTrackMapKeyPair;
5980 InactiveTrackMapKeyPair.first = HLoc;
5981 InactiveTrackMapKeyPair.second = VLoc;
5999 THVPair InactiveTrackMapKeyPair;
6004 InactiveTrackMapKeyPair.first = HLoc;
6005 InactiveTrackMapKeyPair.second = VLoc;
6014 if(InactiveTrackRange.first == InactiveTrackRange.second)
6023 RetPair.first = InactiveTrackRange.first->second;
6024 RetPair.second = (--InactiveTrackRange.second)->second;
6037 AnsiString(DivergingPosition));
6048 if(((SpeedTag1 == 7) && (SpeedTag2 == 10)) ||
6049 ((SpeedTag1 == 10) && (SpeedTag2 == 7)) || ((SpeedTag1 == 8) && (SpeedTag2 == 9)) || ((SpeedTag1 == 9) && (SpeedTag2 == 8)) ||
6050 ((SpeedTag1 == 11) && (SpeedTag2 == 14)) ||
6051 ((SpeedTag1 == 14) && (SpeedTag2 == 11)) || ((SpeedTag1 == 12) && (SpeedTag2 == 13)) || ((SpeedTag1 == 13) && (SpeedTag2 == 12)) ||
6052 ((SpeedTag1 == 28) && (SpeedTag2 == 31)) ||
6053 ((SpeedTag1 == 31) && (SpeedTag2 == 28)) || ((SpeedTag1 == 29) && (SpeedTag2 == 30)) || ((SpeedTag1 == 30) && (SpeedTag2 == 29)) ||
6054 ((SpeedTag1 == 32) && (SpeedTag2 == 35)) ||
6055 ((SpeedTag1 == 35) && (SpeedTag2 == 32)) || ((SpeedTag1 == 33) && (SpeedTag2 == 34)) || ((SpeedTag1 == 34) && (SpeedTag2 == 33)) ||
6056 ((SpeedTag1 == 36) && (SpeedTag2 == 39)) ||
6057 ((SpeedTag1 == 39) && (SpeedTag2 == 36)) || ((SpeedTag1 == 37) && (SpeedTag2 == 38)) || ((SpeedTag1 == 38) && (SpeedTag2 == 37)) ||
6058 ((SpeedTag1 == 40) && (SpeedTag2 == 43)) ||
6059 ((SpeedTag1 == 43) && (SpeedTag2 == 40)) || ((SpeedTag1 == 41) && (SpeedTag2 == 42)) || ((SpeedTag1 == 42) && (SpeedTag2 == 41)))
6093 throw Exception(
"Error, Wrong track type in PlotGap");
6095 if((TrackElement.
SpeedTag == 88) && (TrackElement.
Conn[0] > -1))
6099 else if((TrackElement.
SpeedTag == 88) && (TrackElement.
Conn[0] == -1))
6103 if((TrackElement.
SpeedTag == 89) && (TrackElement.
Conn[0] > -1))
6107 else if((TrackElement.
SpeedTag == 89) && (TrackElement.
Conn[0] == -1))
6111 if((TrackElement.
SpeedTag == 90) && (TrackElement.
Conn[0] > -1))
6115 else if((TrackElement.
SpeedTag == 90) && (TrackElement.
Conn[0] == -1))
6119 if((TrackElement.
SpeedTag == 91) && (TrackElement.
Conn[0] > -1))
6123 else if((TrackElement.
SpeedTag == 91) && (TrackElement.
Conn[0] == -1))
6127 if((TrackElement.
SpeedTag == 92) && (TrackElement.
Conn[0] > -1))
6131 else if((TrackElement.
SpeedTag == 92) && (TrackElement.
Conn[0] == -1))
6135 if((TrackElement.
SpeedTag == 93) && (TrackElement.
Conn[0] > -1))
6139 else if((TrackElement.
SpeedTag == 93) && (TrackElement.
Conn[0] == -1))
6143 if((TrackElement.
SpeedTag == 94) && (TrackElement.
Conn[0] > -1))
6147 else if((TrackElement.
SpeedTag == 94) && (TrackElement.
Conn[0] == -1))
6151 if((TrackElement.
SpeedTag == 95) && (TrackElement.
Conn[0] > -1))
6155 else if((TrackElement.
SpeedTag == 95) && (TrackElement.
Conn[0] == -1))
6171 PosPair.first = TrackElement.
HLoc;
6172 PosPair.second = TrackElement.
VLoc;
6176 Disp->
PlotOutput(283, TrackElement.
HLoc * 16, TrackElement.
VLoc * 16, MOMIt->second);
6189 throw Exception(
"Error, Wrong track type in PlotPoints");
6193 bool FoundFlag =
false;
6195 if(IMPair.first > 0)
6211 else if(TrackElement.
SpeedTag < 132)
6222 else if(!TrackElement.
Failed)
6229 else if(TrackElement.
SpeedTag < 132)
6247 else if(TrackElement.
SpeedTag < 132)
6261 bool BlueLoc =
false;
6270 if(FoundFlag && !BlueLoc)
6285 bool FoundFlag =
false;
6288 throw Exception(
"Error, Wrong track type in PlotSignal");
6292 for(
int x = 0; x < 40; x++)
6375 for(
int x = 0; x < 40; x++)
6382 Graphics::TBitmap* SignalPlatformGraphic;
6384 if(IMPair.first > 0)
6406 for(
int x = 0; x < 8; x++)
6413 if(IMPair.first > 0)
6430 for(
int x = 0; x < 8; x++)
6437 if(IMPair.first > 0)
6530 while(
IsLCAtHV(0, HLoc, (VLoc + UpStep)))
6538 while(
IsLCAtHV(1, HLoc, (VLoc + DownStep)))
6546 while(
IsLCAtHV(2, (HLoc + LeftStep), VLoc))
6554 while(
IsLCAtHV(3, (HLoc + RightStep), VLoc))
6570 while(
IsLCAtHV(51, HLoc, (VLoc + UpStep)))
6578 while(
IsLCAtHV(52, HLoc, (VLoc + DownStep)))
6586 while(
IsLCAtHV(53, (HLoc + LeftStep), VLoc))
6594 while(
IsLCAtHV(54, (HLoc + RightStep), VLoc))
6627 while(
IsLCAtHV(55, HLoc, (VLoc + UpStep)))
6639 while(
IsLCAtHV(56, HLoc, (VLoc + DownStep)))
6651 while(
IsLCAtHV(57, (HLoc + LeftStep), VLoc))
6663 while(
IsLCAtHV(58, (HLoc + RightStep), VLoc))
6705 throw Exception(
"Error, Wrong track type in PlotAndLowerLevelCrossingBarriers");
6707 if((BaseElementSpeedTag != 1) && (BaseElementSpeedTag != 2))
6709 throw Exception(
"Error, Wrong BaseElementSpeedTag value in PlotAndLowerLevelCrossingBarriers");
6712 if(BaseElementSpeedTag == 1)
6716 while(
IsLCAtHV(5, HLoc, (VLoc + UpStep)))
6723 while(
IsLCAtHV(6, HLoc, (VLoc + DownStep)))
6731 Graphics::TBitmap *RouteGraphic;
6733 if(TypeOfRoute == 1)
6737 else if(TypeOfRoute == 0)
6743 RouteGraphic = BaseGraphic;
6750 if(UpStep == DownStep)
6753 Disp->
PlotOutput(133, HLoc * 16, VLoc * 16, RouteGraphic);
6763 else if((DownStep - UpStep) == 1)
6768 Disp->
PlotOutput(136, HLoc * 16, (VLoc + UpStep) * 16, RouteGraphic);
6778 Disp->
PlotOutput(139, HLoc * 16, (VLoc + DownStep) * 16, BaseGraphic);
6791 Disp->
PlotOutput(196, HLoc * 16, (VLoc + UpStep) * 16, BaseGraphic);
6801 Disp->
PlotOutput(199, HLoc * 16, (VLoc + DownStep) * 16, RouteGraphic);
6817 Disp->
PlotOutput(142, HLoc * 16, (VLoc + UpStep) * 16, RouteGraphic);
6827 Disp->
PlotOutput(145, HLoc * 16, (VLoc + DownStep) * 16, BaseGraphic);
6837 else if(DownStep == 0)
6840 Disp->
PlotOutput(202, HLoc * 16, (VLoc + UpStep) * 16, BaseGraphic);
6850 Disp->
PlotOutput(205, HLoc * 16, (VLoc + DownStep) * 16, RouteGraphic);
6863 Disp->
PlotOutput(208, HLoc * 16, (VLoc + UpStep) * 16, BaseGraphic);
6873 Disp->
PlotOutput(211, HLoc * 16, (VLoc + DownStep) * 16, BaseGraphic);
6883 for(
int x = (UpStep + 1); x < DownStep; x++)
6888 Disp->
PlotOutput(148, HLoc * 16, (VLoc + x) * 16, RouteGraphic);
6892 Disp->
PlotOutput(213, HLoc * 16, (VLoc + x) * 16, BaseGraphic);
6913 while(
IsLCAtHV(7, (HLoc + LStep), VLoc))
6920 while(
IsLCAtHV(8, (HLoc + RStep), VLoc))
6926 Graphics::TBitmap *RouteGraphic;
6928 if(TypeOfRoute == 1)
6932 else if(TypeOfRoute == 0)
6938 RouteGraphic = BaseGraphic;
6947 Disp->
PlotOutput(151, HLoc * 16, VLoc * 16, RouteGraphic);
6957 else if((RStep - LStep) == 1)
6962 Disp->
PlotOutput(154, (HLoc + LStep) * 16, VLoc * 16, RouteGraphic);
6972 Disp->
PlotOutput(157, (HLoc + RStep) * 16, VLoc * 16, BaseGraphic);
6985 Disp->
PlotOutput(215, (HLoc + LStep) * 16, VLoc * 16, BaseGraphic);
6995 Disp->
PlotOutput(218, (HLoc + RStep) * 16, VLoc * 16, RouteGraphic);
7011 Disp->
PlotOutput(160, (HLoc + LStep) * 16, VLoc * 16, RouteGraphic);
7021 Disp->
PlotOutput(163, (HLoc + RStep) * 16, VLoc * 16, BaseGraphic);
7034 Disp->
PlotOutput(221, (HLoc + LStep) * 16, VLoc * 16, BaseGraphic);
7044 Disp->
PlotOutput(224, (HLoc + RStep) * 16, VLoc * 16, RouteGraphic);
7057 Disp->
PlotOutput(227, (HLoc + LStep) * 16, VLoc * 16, BaseGraphic);
7067 Disp->
PlotOutput(230, (HLoc + RStep) * 16, VLoc * 16, BaseGraphic);
7077 for(
int x = (LStep + 1); x < RStep; x++)
7082 Disp->
PlotOutput(166, (HLoc + x) * 16, VLoc * 16, RouteGraphic);
7086 Disp->
PlotOutput(232, (HLoc + x) * 16, VLoc * 16, BaseGraphic);
7110 AnsiString(HLoc) +
"," + AnsiString(VLoc));
7113 throw Exception(
"Error, Wrong track type in PlotPlainLoweredLinkedLevelCrossingBarriersAndSetMarkers");
7115 if((BaseElementSpeedTag != 1) && (BaseElementSpeedTag != 2))
7117 throw Exception(
"Error, Wrong BaseElementSpeedTag value in PlotPlainLoweredLinkedLevelCrossingBarriersAndSetMarkers");
7120 if(BaseElementSpeedTag == 1)
7124 while(
IsLCAtHV(30, HLoc, (VLoc + UpStep)))
7131 while(
IsLCAtHV(31, HLoc, (VLoc + DownStep)))
7137 if(UpStep == DownStep)
7148 else if((DownStep - UpStep) == 1)
7167 for(
int x = (UpStep + 1); x < DownStep; x++)
7176 for(
int x = (UpStep + 1); x < DownStep; x++)
7183 for(
int x = UpStep; x <= DownStep; x++)
7196 while(
IsLCAtHV(32, (HLoc + LStep), VLoc))
7203 while(
IsLCAtHV(33, (HLoc + RStep), VLoc))
7220 else if((RStep - LStep) == 1)
7239 for(
int x = (LStep + 1); x < RStep; x++)
7248 for(
int x = (LStep + 1); x < RStep; x++)
7255 for(
int x = LStep; x <= RStep; x++)
7274 throw Exception(
"Error, Wrong track type in PlotAndRaiseLevelCrossingBarriers");
7276 if((BaseElementSpeedTag != 1) && (BaseElementSpeedTag != 2))
7278 throw Exception(
"Error, Wrong BaseElementSpeedTag value in PlotAndRaiseLevelCrossingBarriers");
7281 if(BaseElementSpeedTag == 1)
7285 while(
IsLCAtHV(10, HLoc, (VLoc + UpStep)))
7292 while(
IsLCAtHV(11, HLoc, (VLoc + DownStep)))
7298 for(
int x = UpStep; x < (DownStep + 1); x++)
7313 while(
IsLCAtHV(12, (HLoc + LStep), VLoc))
7320 while(
IsLCAtHV(13, (HLoc + RStep), VLoc))
7326 for(
int x = LStep; x < (RStep + 1); x++)
7345 AnsiString(HLoc) +
"," + AnsiString(VLoc));
7348 throw Exception(
"Error, Wrong track type in PlotPlainRaisedLinkedLevelCrossingBarriersAndSetMarkers");
7350 if((BaseElementSpeedTag != 1) && (BaseElementSpeedTag != 2))
7352 throw Exception(
"Error, Wrong BaseElementSpeedTag value in PlotPlainRaisedLinkedLevelCrossingBarriersAndSetMarkers");
7357 if(BaseElementSpeedTag == 1)
7361 while(
IsLCAtHV(35, HLoc, (VLoc + UpStep)))
7368 while(
IsLCAtHV(36, HLoc, (VLoc + DownStep)))
7374 for(
int x = UpStep; x <= DownStep; x++)
7388 while(
IsLCAtHV(37, (HLoc + LStep), VLoc))
7395 while(
IsLCAtHV(38, (HLoc + RStep), VLoc))
7401 for(
int x = LStep; x <= RStep; x++)
7417 Graphics::TBitmap *RouteGraphic;
7420 if(BaseElementSpeedTag == 1)
7422 if(TypeOfRoute == 1)
7426 else if(TypeOfRoute == 0)
7432 RouteGraphic = BaseGraphic;
7436 RouteGraphic = BaseGraphic;
7442 if(TypeOfRoute == 1)
7446 else if(TypeOfRoute == 0)
7452 RouteGraphic = BaseGraphic;
7456 RouteGraphic = BaseGraphic;
7461 while(
IsLCAtHV(14, HLoc, (VLoc + UpStep)))
7466 Disp->
PlotOutput(175, HLoc * 16, (VLoc + UpStep) * 16, RouteGraphic);
7470 Disp->
PlotOutput(234, HLoc * 16, (VLoc + UpStep) * 16, BaseGraphic);
7477 while(
IsLCAtHV(15, HLoc, (VLoc + DownStep)))
7480 Disp->
PlotOutput(177, HLoc * 16, (VLoc + DownStep) * 16, BaseGraphic);
7485 while(
IsLCAtHV(16, (HLoc + LeftStep), VLoc))
7490 Disp->
PlotOutput(235, (HLoc + LeftStep) * 16, VLoc * 16, RouteGraphic);
7494 Disp->
PlotOutput(236, (HLoc + LeftStep) * 16, VLoc * 16, BaseGraphic);
7501 while(
IsLCAtHV(17, (HLoc + RightStep), VLoc))
7504 Disp->
PlotOutput(238, (HLoc + RightStep) * 16, VLoc * 16, BaseGraphic);
7629 throw Exception(
"Element not found in LowerLCBarriersAtHV " + AnsiString(HLoc) +
"," + AnsiString(VLoc));
7633 throw Exception(
"Element not a level crossing in LowerLCBarriersAtHV " + AnsiString(HLoc) +
"," + AnsiString(VLoc));
7664 "," + AnsiString(VLoc));
7668 int DummyRouteNumber;
7670 TrainPresent =
false;
7674 while(
IsLCAtHV(25, HLoc, (VLoc + UpStep)))
7676 TrackMapKeyPair.first = HLoc;
7677 TrackMapKeyPair.second = VLoc + UpStep;
7678 TrackMapPtr =
TrackMap.find(TrackMapKeyPair);
7687 TrainPresent =
true;
7701 while(
IsLCAtHV(26, HLoc, (VLoc + DownStep)))
7703 TrackMapKeyPair.first = HLoc;
7704 TrackMapKeyPair.second = VLoc + DownStep;
7705 TrackMapPtr =
TrackMap.find(TrackMapKeyPair);
7714 TrainPresent =
true;
7728 while(
IsLCAtHV(27, (HLoc + LeftStep), VLoc))
7730 TrackMapKeyPair.first = HLoc + LeftStep;
7731 TrackMapKeyPair.second = VLoc;
7732 TrackMapPtr =
TrackMap.find(TrackMapKeyPair);
7741 TrainPresent =
true;
7755 while(
IsLCAtHV(28, (HLoc + RightStep), VLoc))
7757 TrackMapKeyPair.first = HLoc + RightStep;
7758 TrackMapKeyPair.second = VLoc;
7759 TrackMapPtr =
TrackMap.find(TrackMapKeyPair);
7768 TrainPresent =
true;
7788 for(
unsigned int x = 0; x < SearchVector.size(); x++)
7805 AnsiString(HLoc) +
"," + AnsiString(VLoc));
7808 throw Exception(
"PlotSmallFlashingLinkedLevelCrossings");
7814 while(
IsLCAtHV(61, HLoc, (VLoc + UpStep)))
7821 while(
IsLCAtHV(62, HLoc, (VLoc + DownStep)))
7827 for(
int x = UpStep; x <= DownStep; x++)
7834 while(
IsLCAtHV(63, (HLoc + LStep), VLoc))
7841 while(
IsLCAtHV(64, (HLoc + RStep), VLoc))
7847 for(
int x = LStep; x <= RStep; x++)
7863 throw Exception(
"Error, Wrong track type in GetFilletGraphic");
7870 else if(TrackElement.
SpeedTag < 132)
7888 for(
unsigned int x = 0; x <
TrackVector.size(); x++)
7905 AnsiString(ScreenPosV));
7920 AnsiString(ScreenPosV));
7931 AnsiString(VPosTrue));
7945 for(
unsigned int a = 0; a <
TrackVector.size(); a++)
7957 throw Exception(
"CheckMapAndTrack Error - failed to find HLoc=" + (AnsiString)CheckElement.
HLoc +
" VLoc=" + (AnsiString)CheckElement.
VLoc +
7958 " in TrackMap, Caller=" + (AnsiString)Caller);
7960 if(MapVecPos != (
int)a)
7962 throw Exception(
"CheckMapAndTrack Error - MapVectorPosition failed at HLoc=" + (AnsiString)CheckElement.
HLoc +
" VLoc=" +
7963 (AnsiString)CheckElement.
VLoc +
" Map value=" + (AnsiString)MapVecPos +
" TrackVectorPos value=" + (AnsiString)a +
" Caller=" +
7964 (AnsiString)Caller);
7970 throw Exception(
"CheckMapAndTrack Error - Map Size=" + (AnsiString)
TrackVector.size() +
" TrackVectorSize=" + (AnsiString)
TrackVector.size() +
7971 " Caller=" + (AnsiString)Caller);
7991 throw Exception(
"CheckMapAndInactiveTrack Error - failed to find HLoc=" + (AnsiString)CheckElement.
HLoc +
" VLoc=" + (AnsiString)CheckElement.
VLoc +
7992 " in InactiveMap, Caller=" + (AnsiString)Caller);
7994 if((InactivePair.first != a) && (InactivePair.second != a))
7996 throw Exception(
"CheckMapAndInactiveTrack Error - InactiveMapVectorPosition failed at HLoc=" + (AnsiString)CheckElement.
HLoc +
" VLoc=" +
7997 (AnsiString)CheckElement.
VLoc +
" Inactive Map values=" + (AnsiString)InactivePair.first +
" and " + (AnsiString)InactivePair.second +
7998 " InactiveTrackVectorPos value=" + (AnsiString)a +
" Caller=" + (AnsiString)Caller);
8003 throw Exception(
"CheckMapAndInactiveTrack Error - Map Size=" + (AnsiString)
TrackVector.size() +
" TrackVectorSize=" + (AnsiString)
TrackVector.size() +
8004 " Caller=" + (AnsiString)Caller);
8014 int Position1, Position2;
8020 for(GapMapPtr =
GapMap.begin(); GapMapPtr !=
GapMap.end(); GapMapPtr++)
8022 int HLoc1 = GapMapPtr->first.first;
8023 int VLoc1 = GapMapPtr->first.second;
8024 int HLoc2 = GapMapPtr->second.first;
8025 int VLoc2 = GapMapPtr->second.second;
8028 throw Exception(
"Failed to find H & V for gap1, GapMap in error");
8032 throw Exception(
"Failed to find H & V for gap2, GapMap in error");
8036 throw Exception(
"Element at Pos1 not a gap, GapMap in error");
8040 throw Exception(
"Element at Pos2 not a gap, GapMap in error");
8044 unsigned int GapCount = 0;
8046 for(
unsigned int a = 0; a <
TrackVector.size(); a++)
8054 if((
GapMap.size() * 2) != GapCount)
8056 throw Exception(
"GapMap Error - Map Size * 2 =" + (AnsiString)(
GapMap.size() * 2) +
" GapCount=" + (AnsiString)GapCount +
" Caller=" +
8057 (AnsiString)Caller);
8067 if((TrackElement.
HLoc == -2000000000) || (TrackElement.
VLoc == -2000000000))
8071 throw Exception(
"Error - TrackFinished with erase element still present");
8076 AnsiString IDString;
8078 if(TrackElement.
HLoc < 0)
8080 IDString =
"N" + AnsiString(abs(TrackElement.
HLoc)) +
"-";
8084 IDString = AnsiString(TrackElement.
HLoc) +
"-";
8086 if(TrackElement.
VLoc < 0)
8088 IDString +=
"N" + AnsiString(abs(TrackElement.
VLoc));
8092 IDString += AnsiString(TrackElement.
VLoc);
8107 for(
int x = 1; x < String.Length() + 1; x++)
8109 if(String.IsDelimiter(
"-", x))
8114 if(x == String.Length())
8118 ShowMessage(
"Error in track element identifier: <" + String +
"> - no delimiter");
8128 ShowMessage(
"Error in track element identifier: <" + String +
"> - No Horizontal value");
8133 if(DelimPos == String.Length())
8137 ShowMessage(
"Error in track element identifier <" + String +
"> - No Vertical value");
8142 if((String[String.Length()] <
'0') || (String[String.Length()] >
'9'))
8146 ShowMessage(
"Error in track element identifier <" + String +
"> - Last value is not a number");
8153 if(String.SubString(1, 1) !=
"N")
8155 for(
int x = 1; x < DelimPos; x++)
8157 if((String.SubString(x, 1) <
"0") || (String.SubString(x, 1) >
"9"))
8161 ShowMessage(
"Invalid character in Horizontal value in track element identifier: <" + String +
">");
8168 if(String.SubString(1, 1) ==
"N")
8170 for(
int x = 2; x < DelimPos; x++)
8172 if((String.SubString(x, 1) <
"0") || (String.SubString(x, 1) >
"9"))
8176 ShowMessage(
"Invalid character in Horizontal value in track element identifier: <" + String +
">");
8183 if(String.SubString(1, 1) ==
"N")
8185 HLoc = -(String.SubString(2, DelimPos - 2).ToInt());
8189 HLoc = String.SubString(1, DelimPos - 1).ToInt();
8191 if(String.SubString(DelimPos + 1, 1) !=
"N")
8193 for(
int x = DelimPos + 1; x < String.Length() + 1; x++)
8195 if((String.SubString(x, 1) <
"0") || (String.SubString(x, 1) >
"9"))
8199 ShowMessage(
"Invalid character in Vertical value in track element identifier: <" + String +
">");
8206 if(String.SubString(DelimPos + 1, 1) ==
"N")
8208 for(
int x = DelimPos + 2; x < String.Length() + 1; x++)
8210 if((String.SubString(x, 1) <
"0") || (String.SubString(x, 1) >
"9"))
8214 ShowMessage(
"Invalid character in Vertical value in track element identifier: <" + String +
">");
8221 if(String.SubString(DelimPos + 1, 1) ==
"N")
8223 VLoc = -(String.SubString(DelimPos + 2, String.Length() - DelimPos - 1).ToInt());
8227 VLoc = String.SubString(DelimPos + 1, String.Length() - DelimPos).ToInt();
8232 TrackMapPtr =
TrackMap.find(HVPair);
8237 ShowMessage(
"No track element corresponding to track element identifier: <" + String +
">");
8243 return(TrackMapPtr->second);
8245 catch(
const Exception &e)
8248 ShowMessage(
"Syntax error in track element identifier: <" + String +
">");
8262 AnsiString(TrackElement.
VLoc) +
"," + AnsiString(TrackElement.
SpeedTag));
8263 int HLoc = TrackElement.
HLoc;
8264 int VLoc = TrackElement.
VLoc;
8367 AnsiString(SpeedTag));
8378 if(HVRange.first == HVRange.second)
8385 HVIt1 = HVRange.first;
8390 if(--HVRange.second != HVRange.first)
8392 HVIt2 = HVRange.second;
8396 HVIt2->second).
SpeedTag == SpeedTag)))
8416 AnsiString(SpeedTag));
8482 AnsiString TestString1, TestString2;
8487 throw Exception(
"LNPendingList size not 1 on entry");
8489 int CurrentElementNumber;
8490 bool FoundFlag =
false, ErasedFlag =
false;
8496 int H = CurrentElement->HLoc;
8497 int V = CurrentElement->VLoc;
8498 int Tag = CurrentElement->SpeedTag;
8504 for(
int x = 0; x < 25; x++)
8514 for(
int x = 0; x < 25; x++)
8524 for(
int x = 0; x < 25; x++)
8534 for(
int x = 0; x < 25; x++)
8544 for(
int x = 0; x < 28; x++)
8554 for(
int x = 0; x < 8; x++)
8564 for(
int x = 0; x < 8; x++)
8574 for(
int x = 0; x < 4; x++)
8590 bool FoundFlag2 =
false;
8608 for(
int x = 0; x < 8; x++)
8618 for(
int x = 0; x < 8; x++)
8631 if(CurrentElementNumber > -1)
8636 if((ExistingName !=
"") && (ExistingName != LocationName))
8652 AddName(1, CurrentElement, LocationName);
8656 LNDone2MultiMapEntry.first = HVPair;
8668 if(SNRange.first != SNRange.second)
8672 for(SNIterator = SNRange.second; SNIterator != SNRange.first; SNIterator--)
8679 TVIt->LocationName =
"";
8680 TVIt->ActiveTrackElementName =
"";
8714 std::pair<AnsiString, char>TempMapPair;
8722 TempMapPair.second =
'x';
8740 AnsiString(SpeedTag));
8750 if((SpeedTag == 129) || (SpeedTag == 130) || (SpeedTag == 145) || (SpeedTag == 146))
8757 int MapPos = -1 - Position;
8761 FoundElement = MapPos;
8777 FoundElement = IMPair.first;
8786 FoundElement = IMPair.second;
8807 AnsiString OldName = TrackElement->LocationName, ErrorString;
8809 TrackElement->LocationName = Name;
8810 int HLoc = TrackElement->HLoc;
8811 int VLoc = TrackElement->VLoc;
8825 if(ErrorString !=
"")
8827 throw Exception(ErrorString +
" in AddName for OldName == " + OldName);
8851 if(LNDone2MultiMapIterator->second == MapPos)
8878 if(*LNPendingListIterator == MapPos)
8951 if(NameBeingChecked !=
"")
8957 ShowMessage(
"Please note that more than one instance of " + NameBeingChecked +
" was found. Location names must be unique before the railway can be saved as a .rly file");
8965 NameBeingChecked = LNMMRg.second->first;
8967 if(NameBeingChecked !=
"")
8973 ShowMessage(
"Please note that more than one instance of " + NameBeingChecked +
" was found. Location names must be unique before the railway can be saved as a .rly file");
8994 if(LNMMIt->second < 0)
9004 HVPairsLinkedMap.insert(std::pair<THVPair, bool>(HVPair,
false));
9012 std::list<THVPair> HVLinkedList;
9015 HVPairsLinkedMap.begin()->second =
true;
9016 HVLinkedList.push_back(HVPairsLinkedMap.begin()->first);
9019 THVPair HVPairUnderExamination;
9020 THVPairsLinkedMap::iterator HVPLMIt;
9022 while(!HVLinkedList.empty())
9024 HVPairUnderExamination = HVLinkedList.front();
9025 HVLinkedList.pop_front();
9026 HVPairNew.first = HVPairUnderExamination.first;
9027 HVPairNew.second = HVPairUnderExamination.second - 1;
9028 HVPLMIt = HVPairsLinkedMap.find(HVPairNew);
9029 if(HVPLMIt != HVPairsLinkedMap.end())
9031 if(!HVPLMIt->second)
9033 HVLinkedList.push_back(HVPLMIt->first);
9035 HVPLMIt->second =
true;
9037 HVPairNew.first = HVPairUnderExamination.first - 1;
9038 HVPairNew.second = HVPairUnderExamination.second;
9039 HVPLMIt = HVPairsLinkedMap.find(HVPairNew);
9040 if(HVPLMIt != HVPairsLinkedMap.end())
9042 if(!HVPLMIt->second)
9044 HVLinkedList.push_back(HVPLMIt->first);
9046 HVPLMIt->second =
true;
9048 HVPairNew.first = HVPairUnderExamination.first;
9049 HVPairNew.second = HVPairUnderExamination.second + 1;
9050 HVPLMIt = HVPairsLinkedMap.find(HVPairNew);
9051 if(HVPLMIt != HVPairsLinkedMap.end())
9053 if(!HVPLMIt->second)
9055 HVLinkedList.push_back(HVPLMIt->first);
9057 HVPLMIt->second =
true;
9059 HVPairNew.first = HVPairUnderExamination.first + 1;
9060 HVPairNew.second = HVPairUnderExamination.second;
9061 HVPLMIt = HVPairsLinkedMap.find(HVPairNew);
9062 if(HVPLMIt != HVPairsLinkedMap.end())
9064 if(!HVPLMIt->second)
9066 HVLinkedList.push_back(HVPLMIt->first);
9068 HVPLMIt->second =
true;
9073 for(THVPairsLinkedMap::iterator HVPLMIt = HVPairsLinkedMap.begin(); HVPLMIt != HVPairsLinkedMap.end(); HVPLMIt++)
9075 if(!HVPLMIt->second)
9094 if(LocationName ==
"")
9105 for(
unsigned int x = 0; x <
TrackVector.size(); x++)
9112 ActiveTrackElementNameMapEntry.second = 0;
9134 bool FoundFlag, ErasedFlag =
false;
9138 if(SNRange.first != SNRange.second)
9141 for(SNIterator = SNRange.first; SNIterator != SNRange.second; SNIterator++)
9144 TVIt->LocationName =
"";
9145 TVIt->ActiveTrackElementName =
"";
9179 AnsiString(VLoc) +
"," + AnsiString(SpeedTag));
9181 AnsiString LocationName;
9190 if(LocationName !=
"")
9198 if(LocationName !=
"")
9212 if(LocationName !=
"")
9214 int ModifiedPosition = -1 - Position;
9223 for(
int x = 0; x < 25; x++)
9233 else if(SpeedTag == 77)
9235 for(
int x = 0; x < 25; x++)
9245 else if(SpeedTag == 78)
9247 for(
int x = 0; x < 25; x++)
9257 else if(SpeedTag == 79)
9259 for(
int x = 0; x < 25; x++)
9269 else if(SpeedTag == 96)
9271 for(
int x = 0; x < 28; x++)
9281 else if(SpeedTag == 129)
9283 for(
int x = 0; x < 8; x++)
9293 else if(SpeedTag == 130)
9295 for(
int x = 0; x < 8; x++)
9305 else if(SpeedTag == 145)
9307 for(
int x = 0; x < 8; x++)
9317 else if(SpeedTag == 146)
9319 for(
int x = 0; x < 8; x++)
9329 else if(SpeedTag == 131)
9331 for(
int x = 0; x < 4; x++)
9351 bool FoundFlag2 =
false;
9378 AnsiString(SpeedTag));
9390 if(TempElement->LocationName !=
"")
9392 LocationName = TempElement->LocationName;
9393 FoundElement = IMPair.first;
9401 if(TempElement->LocationName !=
"")
9403 LocationName = TempElement->LocationName;
9404 FoundElement = IMPair.second;
9416 if(TempElement->LocationName !=
"")
9418 LocationName = TempElement->LocationName;
9419 FoundElement = -1 - Position;
9435 unsigned int Count = 0;
9442 AnsiString SName, TName, ErrorString;
9444 for(
unsigned int x = 0; x <
TrackVector.size(); x++)
9450 throw Exception(
"Track element has FixedNamedLocationElement set but is not a footbridge/underpass in CheckLocationNameMultiMap, caller = " +
9451 AnsiString(Caller));
9464 (
"Inactive track element has FixedNamedLocationElement set but is not a platform, concourse or named location in CheckLocationNameMultiMap, caller = " +
9465 AnsiString(Caller));
9472 throw Exception(
"LocationNameMultiMap size = " + AnsiString(
LocationNameMultiMap.size()) +
" & Count = " + AnsiString(Count) +
9473 " in CheckLocationNameMultiMap, caller = " + AnsiString(Caller));
9478 for(
unsigned int x = 0; x <
TrackVector.size(); x++)
9484 if(ErrorString !=
"")
9486 throw Exception(ErrorString +
" in CheckLocationNameMultiMap for TrackVector check, caller = " + AnsiString(Caller));
9488 if(SNIt->second != -1 - (
int)x)
9490 throw Exception(
"Elements different in name map & TrackVector in CheckLocationNameMultiMap for TrackVector check, caller = " +
9491 AnsiString(Caller));
9497 bool FoundFlag =
false;
9506 throw Exception(
"Track element with ActiveTrackElementName but no plat/named loc at H " + AnsiString(
TrackElementAt(1369, x).HLoc) +
" & V " +
9507 AnsiString(
TrackElementAt(1370, x).VLoc) +
" in CheckLocationNameMultiMap, caller = " + AnsiString(Caller));
9511 throw Exception(
"Track element with ActiveTrackElementName " + TName +
" but plat/named loc at H " + AnsiString(
TrackElementAt(1371, x).HLoc) +
9512 " & V " + AnsiString(
TrackElementAt(1372, x).VLoc) +
" has different LocationName in CheckLocationNameMultiMap, caller = " +
9513 AnsiString(Caller));
9518 throw Exception(
"Track element with ActiveTrackElementName but no inactive element at H " + AnsiString(
TrackElementAt(1373, x).HLoc) +
" & V " +
9519 AnsiString(
TrackElementAt(1374, x).VLoc) +
" in CheckLocationNameMultiMap, caller = " + AnsiString(Caller));
9529 if(ErrorString !=
"")
9531 throw Exception(ErrorString +
" in CheckLocationNameMultiMap for InactiveTrackVector check, caller = " + AnsiString(Caller));
9533 if(SNIt->second != (
int)x)
9535 throw Exception(
"Elements different in name map & TrackVector in CheckLocationNameMultiMap for TrackVector check, caller = " +
9536 AnsiString(Caller));
9546 AnsiString &ErrorString)
9554 AnsiString(TrackElement->HLoc) +
"," + AnsiString(TrackElement->VLoc) +
"," + AnsiString(TrackElement->SpeedTag));
9556 bool FoundFlag =
false;
9560 if(SNRange.first == SNRange.second)
9562 ErrorString =
"Error, Name " + LocationName +
" not found in map";
9564 return(SNRange.first);
9568 for(SNIterator = SNRange.first; SNIterator != SNRange.second; SNIterator++)
9570 if(SNIterator->second < 0)
9572 int TVPos = -1 - SNIterator->second;
9574 if(TVIt == TrackElement)
9583 int ITVPos = SNIterator->second;
9585 if(ITVIt == TrackElement)
9596 ErrorString =
"Error, Name " + LocationName +
" found but not at required element";
9613 LocationNameEntry.first = NewName;
9614 LocationNameEntry.second = SNIterator->second;
9628 int TruePos = -1 - Position;
9632 throw Exception(
"Footbridge/underpass error in GetTrackVectorIteratorFromNamePosition, caller = " + AnsiString(Caller));
9642 throw Exception(
"Inactive element error in GetTrackVectorIteratorFromNamePosition, caller = " + AnsiString(Caller));
9665 InactiveTrack2MultiMapIterator++)
9667 if(InactiveTrack2MultiMapIterator->second > VecPos)
9669 InactiveTrack2MultiMapIterator->second--;
9677 LocationNameMultiMapIterator++)
9679 if(LocationNameMultiMapIterator->second < 0)
9683 if(LocationNameMultiMapIterator->second > (
int)VecPos)
9685 LocationNameMultiMapIterator->second--;
9707 for(TrackMapIterator =
TrackMap.begin(); TrackMapIterator !=
TrackMap.end(); TrackMapIterator++)
9709 if(TrackMapIterator->second > VecPos)
9711 TrackMapIterator->second--;
9719 LocationNameMultiMapIterator++)
9721 if(LocationNameMultiMapIterator->second >= 0)
9727 if(LocationNameMultiMapIterator->second < -(
int)(VecPos + 1))
9729 LocationNameMultiMapIterator->second++;
9733 for(
unsigned int x = 0; x <
TrackVector.size(); x++)
9739 if(TkEl.
Conn[0] ==
int(VecPos))
9744 if(TkEl.
Conn[0] >
int(VecPos))
9748 if(TkEl.
Conn[0] > -1)
9776 for(
unsigned int TVPos = 0; TVPos <
TrackVector.size(); TVPos++)
9782 LocationNameEntry.second = -1 - TVPos;
9793 LocationNameEntry.second = ITVPos;
9835 for(
unsigned int x = 0; x <
TrackVector.size(); x++)
9867 for(
unsigned int x = 0; x <
TrackVector.size(); x++)
9888 for(
unsigned int x = 0; x <
TrackVector.size(); x++)
9914 AnsiString((
short)FirstTrack));
9916 int EXArray[16][2] =
9918 {2, 4}, {6, 2}, {8, 6}, {4, 8},
9919 {1, 6}, {3, 8}, {9, 4}, {7, 2}, {1, 8}, {3, 4}, {9, 2}, {7, 6},
9922 int Index = -1, BrNum = -1, GrNum = -1, InLink, OutLink;
9923 Graphics::TBitmap *Bitmap;
9929 InLink = TrackElement.
Link[0];
9930 OutLink = TrackElement.
Link[1];
9936 InLink = TrackElement.
Link[2];
9937 OutLink = TrackElement.
Link[3];
9941 for(
int x = 0; x < 16; x++)
9943 if((InLink == EXArray[x][0] && OutLink == EXArray[x][1]) || (InLink == EXArray[x][1] && OutLink == EXArray[x][0]))
9950 throw Exception(
"Error, failed to find Index in TTrack::MarkOneLengthandSpeed");
9971 else if(TrackElement.
SpeedTag == 54)
9975 else if(TrackElement.
SpeedTag == 55)
9986 else if(TrackElement.
SpeedTag == 58)
9990 else if(TrackElement.
SpeedTag == 59)
9995 else if(Index == 14)
10001 else if(TrackElement.
SpeedTag == 52)
10005 else if(TrackElement.
SpeedTag == 57)
10010 else if(Index == 15)
10016 else if(TrackElement.
SpeedTag == 53)
10020 else if(TrackElement.
SpeedTag == 56)
10102 TRect Rect(0,0,16,16);
10106 int Red, Green, Blue;
10107 int *R = &Red, *G = &Green, *B = &Blue;
10121 Col = TColor((65536 * Blue) + (256 * Green) + Red);
10135 Col = TColor((65536 * Blue) + (256 * Green) + Red);
10159 AnsiString((
short)FirstTrack));
10160 bool LengthDifferent =
false, SpeedDifferent =
false;
10167 int EXArray[16][2] =
10169 {2, 4}, {6, 2}, {8, 6}, {4, 8},
10170 {1, 6}, {3, 8}, {9, 4}, {7, 2}, {1, 8}, {3, 4}, {9, 2}, {7, 6},
10173 int Index = -1, BrNum = -1, GrNum = -1, InLink, OutLink;
10174 Graphics::TBitmap *Bitmap;
10178 InLink = TrackElement.
Link[0];
10179 OutLink = TrackElement.
Link[1];
10183 InLink = TrackElement.
Link[2];
10184 OutLink = TrackElement.
Link[3];
10186 for(
int x = 0; x < 16; x++)
10188 if((InLink == EXArray[x][0] && OutLink == EXArray[x][1]) || (InLink == EXArray[x][1] && OutLink == EXArray[x][0]))
10195 throw Exception(
"Error, failed to find Index in TTrack::MarkOneLengthandSpeed");
10215 else if(TrackElement.
SpeedTag == 54)
10219 else if(TrackElement.
SpeedTag == 55)
10224 else if(Index == 0)
10230 else if(TrackElement.
SpeedTag == 58)
10234 else if(TrackElement.
SpeedTag == 59)
10239 else if(Index == 14)
10245 else if(TrackElement.
SpeedTag == 52)
10249 else if(TrackElement.
SpeedTag == 57)
10254 else if(Index == 15)
10260 else if(TrackElement.
SpeedTag == 53)
10264 else if(TrackElement.
SpeedTag == 56)
10278 if(LengthDifferent && SpeedDifferent)
10346 else if(LengthDifferent && !SpeedDifferent)
10493 AnsiString((
short)FirstTrack));
10494 LengthDifferent =
false;
10495 SpeedDifferent =
false;
10500 LengthDifferent =
true;
10504 SpeedDifferent =
true;
10506 if(LengthDifferent || SpeedDifferent)
10519 LengthDifferent =
true;
10523 SpeedDifferent =
true;
10525 if(LengthDifferent || SpeedDifferent)
10538 LengthDifferent =
true;
10542 SpeedDifferent =
true;
10544 if(LengthDifferent || SpeedDifferent)
10624 AnsiString TempName;
10625 int VecPos, StartVecPos, Count, EntryPos, StartEntryPos, ForwardNumber, ReverseNumber;
10626 bool ForwardSet, ReverseSet;
10628 for(
unsigned int x = 0; x <
TrackVector.size(); x++)
10633 for(
unsigned int x = 0; x <
TrackVector.size(); x++)
10638 ForwardSet =
false;
10639 ReverseSet =
false;
10673 for(
int y = 0; y < 2; y++)
10704 StartElement = TempElement;
10705 StartVecPos = VecPos;
10708 EntryPos = 1 - Dir;
10709 StartEntryPos = 1 - Dir;
10717 VecPos = TempElement.
Conn[1 - EntryPos];
10718 int TempEntryPos = TempElement.
ConnLinkPos[1 - EntryPos];
10720 EntryPos = TempEntryPos;
10741 ForwardNumber = ((Count + 1) / 2) + 1;
10742 ReverseNumber = (Count - ForwardNumber) + 1;
10744 EntryPos = 1 - Dir;
10745 TempElement = StartElement;
10746 VecPos = StartVecPos;
10747 if(Count == ForwardNumber)
10752 if(Count == ReverseNumber)
10760 VecPos = TempElement.
Conn[1 - EntryPos];
10761 int TempEntryPos = TempElement.
ConnLinkPos[1 - EntryPos];
10763 EntryPos = TempEntryPos;
10765 if(Count == ForwardNumber)
10770 if(Count == ReverseNumber)
10783 for(
unsigned int x = 0; x <
TrackVector.size(); x++)
10812 AnsiString TempName;
10813 std::list<unsigned int> NameList;
10814 std::list<AnsiString> ContinuationNameList;
10815 for(
unsigned int x = 0; x <
TrackVector.size(); x++)
10821 ContinuationNameList.push_back(
TrackElementAt(1597, x).ActiveTrackElementName);
10824 ContinuationNameList.sort();
10825 ContinuationNameList.unique();
10827 for(
unsigned int x = 0; x <
TrackVector.size(); x++)
10832 bool NameIsAContinuation =
false;
10833 if(std::find(ContinuationNameList.begin(), ContinuationNameList.end(), TempElement.
ActiveTrackElementName) != ContinuationNameList.end())
10835 NameIsAContinuation =
true;
10848 if(((TempElement.
Conn[2] > -1)) && (TempElement.
Conn[3] > -1) &&
10856 NameList.push_back(x);
10861 if((TempElement.
Conn[2] > -1) && (TempElement.
Conn[3] > -1) &&
10869 NameList.push_back(x);
10879 NameList.push_back(x);
10882 while(!NameList.empty())
10884 unsigned int a = NameList.front();
10885 NameList.pop_front();
11043 for(
unsigned int x = 0; x <
TrackVector.size(); x++)
11099 if((TextH / 16) - 1 <
HLocMin)
11103 if((TextH / 16) + 1 >
HLocMax)
11107 if((TextV / 16) - 1 <
VLocMin)
11111 if((TextV / 16) + 1 >
VLocMax)
11141 void TTrack::UserGraphicMove(
int Caller,
int HPosInput,
int VPosInput,
int &UserGraphicItem,
int &UserGraphicMoveHPos,
int &UserGraphicMoveVPos,
11142 bool &UserGraphicFoundFlag)
11145 TUserGraphicVector::iterator UserGraphicPtr;
11147 UserGraphicFoundFlag =
false;
11154 if((HPosInput >= (*UserGraphicPtr).HPos) && (HPosInput < ((*UserGraphicPtr).HPos + (*UserGraphicPtr).Width)) && (VPosInput >=
11155 (*UserGraphicPtr).VPos) && (VPosInput < ((*UserGraphicPtr).VPos + (*UserGraphicPtr).Height)))
11157 UserGraphicItem = x;
11158 UserGraphicMoveHPos = (*UserGraphicPtr).HPos;
11159 UserGraphicMoveVPos = (*UserGraphicPtr).VPos;
11160 UserGraphicFoundFlag =
true;
11178 int SpeedTag = TrackElement.
SpeedTag;
11182 throw Exception(
"Error - SpeedTag value " + AnsiString(SpeedTag) +
" in RetrieveStripedNamedLocationGraphicsWhereRelevant");
11231 return(GraphicOutput);
11239 if((At < 0) || ((
unsigned int)At >=
TrackVector.size()))
11242 throw Exception(
"Out of Range Error, vector size: " + AnsiString(
TrackVector.size()) +
", At: " + AnsiString(At) +
" in TrackElementAt");
11255 throw Exception(
"Out of Range Error, vector size: " + AnsiString(
InactiveTrackVector.size()) +
", At: " + AnsiString(At) +
11256 " in InactiveTrackElementAt");
11267 if((At < 0) || ((
unsigned int)At >=
TrackVector.size()))
11269 throw Exception(
"Out of Range Error, vector size: " + AnsiString(
TrackVector.size()) +
", At: " + AnsiString(At) +
" in BlankElementAt");
11294 TTrackElement InactiveElement, FirstNamedElement, SecondNamedElement, FirstNamedLinkedElement, SecondNamedLinkedElement;
11295 int FirstNamedExitPos, SecondNamedExitPos, FirstNamedLinkedExitPos, SecondNamedLinkedEntryPos;
11299 if(SNRange.first == SNRange.second)
11304 for(SNIterator = SNRange.first; SNIterator != SNRange.second; SNIterator++)
11306 if(SNIterator->second < 0)
11320 HVPair.first = InactiveElement.
HLoc;
11321 HVPair.second = InactiveElement.
VLoc;
11325 (
"Error - failed to find element in TrackMap for a non-concourse element in LocationNameMultiMap in OneStationLongEnoughForSplit (1)");
11327 int TVPos =
TrackMap.find(HVPair)->second;
11330 if((FirstNamedElement.
Conn[0] == -1) || (FirstNamedElement.
Conn[1] == -1))
11336 FirstNamedExitPos = 0;
11338 SecondNamedElement =
TrackElementAt(561, FirstNamedElement.
Conn[FirstNamedExitPos]);
11340 FirstNamedLinkedElement =
TrackElementAt(562, FirstNamedElement.
Conn[1 - FirstNamedExitPos]);
11341 FirstNamedLinkedExitPos = FirstNamedElement.
ConnLinkPos[1 - FirstNamedExitPos];
11344 if(SecondNamedElement.
Conn[SecondNamedExitPos] > -1)
11346 SecondNamedLinkedElement =
TrackElementAt(563, SecondNamedElement.
Conn[SecondNamedExitPos]);
11347 SecondNamedLinkedEntryPos = SecondNamedElement.
ConnLinkPos[SecondNamedExitPos];
11348 if((SecondNamedLinkedElement.
TrackType !=
Points) || (SecondNamedLinkedEntryPos != 3))
11351 if((FirstNamedLinkedElement.
TrackType !=
Points) || (FirstNamedLinkedExitPos != 3))
11361 FirstNamedExitPos = 1;
11363 SecondNamedElement =
TrackElementAt(564, FirstNamedElement.
Conn[FirstNamedExitPos]);
11365 FirstNamedLinkedElement =
TrackElementAt(565, FirstNamedElement.
Conn[1 - FirstNamedExitPos]);
11366 FirstNamedLinkedExitPos = FirstNamedElement.
ConnLinkPos[1 - FirstNamedExitPos];
11369 if(SecondNamedElement.
Conn[SecondNamedExitPos] > -1)
11371 SecondNamedLinkedElement =
TrackElementAt(566, SecondNamedElement.
Conn[SecondNamedExitPos]);
11372 SecondNamedLinkedEntryPos = SecondNamedElement.
ConnLinkPos[SecondNamedExitPos];
11373 if((SecondNamedLinkedElement.
TrackType !=
Points) || (SecondNamedLinkedEntryPos != 3))
11376 if((FirstNamedLinkedElement.
TrackType !=
Points) || (FirstNamedLinkedExitPos != 3))
11402 TTrackElement InactiveElement, FirstNamedElement, SecondNamedElement, FirstNamedLinkedElement, SecondNamedLinkedElement;
11403 int FirstNamedExitPos, SecondNamedEntryPos, SecondNamedExitPos;
11407 if(SNRange.first == SNRange.second)
11412 for(SNIterator = SNRange.first; SNIterator != SNRange.second; SNIterator++)
11414 if(SNIterator->second < 0)
11428 HVPair.first = InactiveElement.
HLoc;
11429 HVPair.second = InactiveElement.
VLoc;
11432 throw Exception (
"Error - failed to find element in TrackMap for a non-concourse element in LocationNameMultiMap in OneNonStationLongEnoughForSplit(1)");
11434 int TVPos =
TrackMap.find(HVPair)->second;
11437 if(((FirstNamedElement.
Conn[0] == -1) || (FirstNamedElement.
Conn[1] == -1)) && ((FirstNamedElement.
Conn[2] == -1) || (FirstNamedElement.
Conn[3] == -1)))
11442 if((FirstNamedElement.
Conn[2] == -1) || (FirstNamedElement.
Conn[3] == -1))
11444 FirstNamedExitPos = 0;
11446 SecondNamedElement =
TrackElementAt(1611, FirstNamedElement.
Conn[FirstNamedExitPos]);
11449 SecondNamedEntryPos = FirstNamedElement.
ConnLinkPos[FirstNamedExitPos];
11450 if((SecondNamedEntryPos == 0) || (SecondNamedEntryPos == 1))
11452 SecondNamedExitPos = 1 - SecondNamedEntryPos;
11454 else if(SecondNamedEntryPos == 2)
11456 SecondNamedExitPos = 3;
11458 else if(SecondNamedEntryPos == 3)
11460 SecondNamedExitPos = 2;
11462 if(SecondNamedElement.
Conn[SecondNamedExitPos] > -1)
11469 FirstNamedExitPos = 1;
11471 SecondNamedElement =
TrackElementAt(1612, FirstNamedElement.
Conn[FirstNamedExitPos]);
11474 SecondNamedEntryPos = FirstNamedElement.
ConnLinkPos[FirstNamedExitPos];
11475 if((SecondNamedEntryPos == 0) || (SecondNamedEntryPos == 1))
11477 SecondNamedExitPos = 1 - SecondNamedEntryPos;
11479 else if(SecondNamedEntryPos == 2)
11481 SecondNamedExitPos = 3;
11483 else if(SecondNamedEntryPos == 3)
11485 SecondNamedExitPos = 2;
11487 if(SecondNamedElement.
Conn[SecondNamedExitPos] > -1)
11495 else if((FirstNamedElement.
Conn[0] == -1) || (FirstNamedElement.
Conn[1] == -1))
11497 FirstNamedExitPos = 2;
11499 SecondNamedElement =
TrackElementAt(1613, FirstNamedElement.
Conn[FirstNamedExitPos]);
11502 SecondNamedEntryPos = FirstNamedElement.
ConnLinkPos[FirstNamedExitPos];
11503 if((SecondNamedEntryPos == 0) || (SecondNamedEntryPos == 1))
11505 SecondNamedExitPos = 1 - SecondNamedEntryPos;
11507 else if(SecondNamedEntryPos == 2)
11509 SecondNamedExitPos = 3;
11511 else if(SecondNamedEntryPos == 3)
11513 SecondNamedExitPos = 2;
11515 if(SecondNamedElement.
Conn[SecondNamedExitPos] > -1)
11522 FirstNamedExitPos = 3;
11524 SecondNamedElement =
TrackElementAt(1614, FirstNamedElement.
Conn[FirstNamedExitPos]);
11527 SecondNamedEntryPos = FirstNamedElement.
ConnLinkPos[FirstNamedExitPos];
11528 if((SecondNamedEntryPos == 0) || (SecondNamedEntryPos == 1))
11530 SecondNamedExitPos = 1 - SecondNamedEntryPos;
11532 else if(SecondNamedEntryPos == 2)
11534 SecondNamedExitPos = 3;
11536 else if(SecondNamedEntryPos == 3)
11538 SecondNamedExitPos = 2;
11540 if(SecondNamedElement.
Conn[SecondNamedExitPos] > -1)
11557 int MidEntryPos,
int &FrontTrainFrontPos,
int &FrontTrainRearPos,
int &RearTrainFrontPos,
int &RearTrainRearPos,
bool &TemporaryDelay)
11565 LocationName + AnsiString(LeadElement) +
"," + AnsiString(LeadExitPos) +
"," + AnsiString(MidElement) +
"," + AnsiString(MidEntryPos));
11567 TemporaryDelay =
false;
11569 int FwdPos[3] = {LeadElement, -1, -1};
11570 int RwdPos[3] = {MidElement, -1, -1};
11573 int FwdPos1EntryPos, FwdPos1ExitPos, FwdPos2EntryPos, FwdPos2ExitPos, RwdPos1EntryPos, RwdPos1ExitPos, RwdPos2EntryPos, RwdPos2ExitPos;
11575 bool FwdDerail1 =
false, FwdDerail2 =
false, RwdDerail1 =
false, RwdDerail2 =
false;
11576 int NumFwdNamedElements = 0, NumFwdElements = 0, NumRwdNamedElements = 0, NumRwdElements = 1;
11579 NumRwdNamedElements = 1;
11582 FwdPos[1] = FwdPos0Element.
Conn[LeadExitPos];
11585 NumFwdElements = 1;
11589 NumFwdNamedElements = 1;
11591 FwdPos1EntryPos = FwdPos0Element.
ConnLinkPos[LeadExitPos];
11593 FwdPos[2] = FwdPos1Element.
Conn[FwdPos1ExitPos];
11596 NumFwdElements = 2;
11597 FwdPos2EntryPos = FwdPos1Element.
ConnLinkPos[FwdPos1ExitPos];
11602 NumFwdNamedElements = 2;
11608 RwdPos[1] = RwdPos0Element.
Conn[MidEntryPos];
11611 NumRwdElements = 2;
11615 NumRwdNamedElements = 2;
11617 RwdPos1ExitPos = RwdPos0Element.
ConnLinkPos[MidEntryPos];
11619 RwdPos[2] = RwdPos1Element.
Conn[RwdPos1EntryPos];
11622 NumRwdElements = 3;
11623 RwdPos2ExitPos = RwdPos1Element.
ConnLinkPos[RwdPos1EntryPos];
11628 NumRwdNamedElements = 3;
11635 if(NumFwdNamedElements == 2)
11637 FrontTrainFrontPos = FwdPos[2];
11638 FrontTrainRearPos = FwdPos[1];
11639 RearTrainFrontPos = LeadElement;
11640 RearTrainRearPos = MidElement;
11641 if(FwdDerail1 || FwdDerail2)
11643 TrainController->
StopTTClockMessage(159, HeadCode +
" unable to split at " + LocationName +
", points set wrongly ahead of train. Please change these points to allow the split.");
11644 TemporaryDelay =
true;
11650 TrainController->
StopTTClockMessage(160, HeadCode +
" unable to split at " + LocationName +
" because another train is obstructing ahead of this train. Please move the obstructing train to allow the split.");
11651 TemporaryDelay =
true;
11657 TrainController->
StopTTClockMessage(161, HeadCode +
" unable to split at " + LocationName +
" because another train is obstructing ahead of this train. Please move the obstructing train to allow the split.");
11658 TemporaryDelay =
true;
11666 else if((NumFwdNamedElements == 1) && (NumRwdNamedElements >= 1) && (NumRwdElements >= 2))
11668 FrontTrainFrontPos = FwdPos[1];
11669 FrontTrainRearPos = LeadElement;
11670 RearTrainFrontPos = MidElement;
11671 RearTrainRearPos = RwdPos[1];
11674 TrainController->
StopTTClockMessage(162, HeadCode +
" unable to split at " + LocationName +
", points set wrongly ahead of train. Please change these points to allow the split.");
11675 TemporaryDelay =
true;
11681 TrainController->
StopTTClockMessage(163, HeadCode +
" unable to split at " + LocationName +
", points set wrongly behind train. Please change these points to allow the split.");
11682 TemporaryDelay =
true;
11688 TrainController->
StopTTClockMessage(164, HeadCode +
" unable to split at " + LocationName +
" because another train is obstructing ahead of this train. Please move the obstructing train to allow the split.");
11689 TemporaryDelay =
true;
11695 TrainController->
StopTTClockMessage(165, HeadCode +
" unable to split at " + LocationName +
" because another train is obstructing behind this train. Please move the obstructing train to allow the split.");
11696 TemporaryDelay =
true;
11704 else if((NumRwdNamedElements >= 2) && (NumRwdElements == 3))
11706 FrontTrainFrontPos = LeadElement;
11707 FrontTrainRearPos = MidElement;
11708 RearTrainFrontPos = RwdPos[1];
11709 RearTrainRearPos = RwdPos[2];
11710 if(RwdDerail1 || RwdDerail2)
11712 TrainController->
StopTTClockMessage(166, HeadCode +
" unable to split at " + LocationName +
", points set wrongly behind train. Please change these points to allow the split.");
11713 TemporaryDelay =
true;
11719 TrainController->
StopTTClockMessage(167, HeadCode +
" unable to split at " + LocationName +
" because another train is obstructing behind this train. Please move the obstructing train to allow the split.");
11720 TemporaryDelay =
true;
11726 TrainController->
StopTTClockMessage(168, HeadCode +
" unable to split at " + LocationName +
" because another train is obstructing behind this train. Please move the obstructing train to allow the split.");
11727 TemporaryDelay =
true;
11736 else if((NumFwdNamedElements == 1) && (NumFwdElements == 2))
11738 FrontTrainFrontPos = FwdPos[2];
11739 FrontTrainRearPos = FwdPos[1];
11740 RearTrainFrontPos = LeadElement;
11741 RearTrainRearPos = MidElement;
11742 if(FwdDerail1 || FwdDerail2)
11744 TrainController->
StopTTClockMessage(169, HeadCode +
" unable to split at " + LocationName +
", points set wrongly ahead of train. Please change these points to allow the split.");
11745 TemporaryDelay =
true;
11751 TrainController->
StopTTClockMessage(170, HeadCode +
" unable to split at " + LocationName +
" because another train is obstructing ahead of this train. Please move the obstructing train to allow the split.");
11752 TemporaryDelay =
true;
11758 TrainController->
StopTTClockMessage(171, HeadCode +
" unable to split at " + LocationName +
" because another train is obstructing ahead of this train. Please move the obstructing train to allow the split.");
11759 TemporaryDelay =
true;
11767 else if((NumFwdElements >= 1) && (NumRwdNamedElements >= 1) && (NumRwdElements >= 2))
11769 FrontTrainFrontPos = FwdPos[1];
11770 FrontTrainRearPos = LeadElement;
11771 RearTrainFrontPos = MidElement;
11772 RearTrainRearPos = RwdPos[1];
11775 TrainController->
StopTTClockMessage(172, HeadCode +
" unable to split at " + LocationName +
", points set wrongly ahead of train. Please change these points to allow the split.");
11776 TemporaryDelay =
true;
11782 TrainController->
StopTTClockMessage(173, HeadCode +
" unable to split at " + LocationName +
", points set wrongly behind train. Please change these points to allow the split.");
11783 TemporaryDelay =
true;
11789 TrainController->
StopTTClockMessage(174, HeadCode +
" unable to split at " + LocationName +
" because another train is obstructing ahead of this train. Please move the obstructing train to allow the split.");
11790 TemporaryDelay =
true;
11796 TrainController->
StopTTClockMessage(175, HeadCode +
" unable to split at " + LocationName +
" because another train is obstructing behind this train. Please move the obstructing train to allow the split.");
11797 TemporaryDelay =
true;
11817 if(SNRange.first != SNRange.second)
11819 for(SNIterator = SNRange.first; SNIterator != SNRange.second; SNIterator++)
11821 if(SNIterator->second < 0)
11843 "," + AnsiString(SpeedTag));
11854 throw Exception(
"Error, FoundFlag false in PlatformOnSignalSide after IsPlatformOrNamedNonStationLocationPresent called successfully");
11884 else if(SpeedTag == 69)
11910 else if(SpeedTag == 70)
11936 else if(SpeedTag == 71)
11973 AnsiString(LinkPos) +
"," + AnsiString(OwnTrainID));
11974 if((LinkPos < 0) || (TrackPos < 0))
12006 throw Exception(
"Out of Range Error, vector size: " + AnsiString(
TrackVector.size()) +
", At: " + AnsiString(At) +
" in SelectVectorAt");
12018 AnsiString(VLocIn) +
"," + AnsiString(LinkIn));
12019 bool FoundFlag =
false;
12034 int VLocHi = -2000000000, VLocLo = 2000000000, HLoc = 2000000000;
12035 bool FoundFlag =
false;
12060 VPosHi = 16 * VLocHi;
12061 VPosLo = 16 * VLocLo;
12080 AnsiString(EndTVPosition));
12091 int Link0Squares = ((EndElement.
HLoc - NewHLocLink0) * (EndElement.
HLoc - NewHLocLink0)) +
12092 ((EndElement.
VLoc - NewVLocLink0) * (EndElement.
VLoc - NewVLocLink0));
12093 int Link1Squares = ((EndElement.
HLoc - NewHLocLink1) * (EndElement.
HLoc - NewHLocLink1)) +
12094 ((EndElement.
VLoc - NewVLocLink1) * (EndElement.
VLoc - NewVLocLink1));
12096 if(Link0Squares <= Link1Squares)
12114 AnsiString(LinkPos));
12133 if((LinkPos == 1) && (TE.
Attribute == 0))
12138 else if(LinkPos == 1)
12144 else if((LinkPos == 3) && (TE.
Attribute == 1))
12149 else if(LinkPos == 3)
12156 else if(LinkPos == 0)
12161 else if(LinkPos == 1)
12166 else if(LinkPos == 2)
12171 else if(LinkPos == 3)
12176 throw Exception(
"Error, failure in GetExitPos");
12225 if((TE.
Link[0] == Link) || (TE.
Link[1] == Link))
12229 else if((TE.
Link[2] == Link) || (TE.
Link[3] == Link))
12271 "," + AnsiString(DiagonalLinkNumber));
12276 if(((DiagonalLinkNumber == 1) &&
TrainOnLink(8, HLoc - 1, VLoc, 3, TrainID)) || ((DiagonalLinkNumber == 7) &&
TrainOnLink(9, HLoc - 1, VLoc, 9, TrainID)))
12281 if(((DiagonalLinkNumber == 1) &&
TrainOnLink(10, HLoc, VLoc - 1, 7, TrainID)) || ((DiagonalLinkNumber == 3) &&
TrainOnLink(11, HLoc, VLoc - 1, 9, TrainID)))
12286 if(((DiagonalLinkNumber == 3) &&
TrainOnLink(12, HLoc + 1, VLoc, 1, TrainID)) || ((DiagonalLinkNumber == 9) &&
TrainOnLink(13, HLoc + 1, VLoc, 7, TrainID)))
12291 if(((DiagonalLinkNumber == 7) &&
TrainOnLink(14, HLoc, VLoc + 1, 1, TrainID)) || ((DiagonalLinkNumber == 9) &&
TrainOnLink(15, HLoc, VLoc + 1, 3, TrainID)))
12307 AnsiString JustFileName =
"";
12312 int LastDelim = UGI.
FileName.LastDelimiter(
'\\');
12319 JustFileName = UGI.
FileName.SubString(LastDelim + 1, UGI.
FileName.Length() - LastDelim);
12338 typedef std::list<int> TNamePosList;
12339 TNamePosList NamePosList;
12340 typedef TNamePosList::iterator TNPLIt;
12342 typedef std::list<int> TOnePlatList;
12343 TOnePlatList OnePlatList;
12344 typedef TOnePlatList::iterator TOPLIt;
12347 NamePosList.clear();
12348 OnePlatList.clear();
12349 for(
unsigned int x = 0; x <
TrackVector.size(); x++)
12351 if(
TrackElementAt(988, x).ActiveTrackElementName == LocationName)
12353 NamePosList.push_back(x);
12358 if(!NamePosList.empty())
12360 OnePlatList.push_back(NamePosList.back());
12361 NamePosList.pop_back();
12363 while(!OnePlatList.empty())
12365 TempInt = OnePlatList.front();
12368 NPLIt = find(NamePosList.begin(), NamePosList.end(), TempElement.
Conn[0]);
12369 if(NPLIt != NamePosList.end() && ((TempElement.
Link[0] == 2) || (TempElement.
Link[0] == 4) || (TempElement.
Link[0] == 6) || (TempElement.
Link[0] == 8)))
12371 OnePlatList.push_back(TempElement.
Conn[0]);
12372 NamePosList.erase(NPLIt);
12374 NPLIt = find(NamePosList.begin(), NamePosList.end(), TempElement.
Conn[1]);
12375 if(NPLIt != NamePosList.end() && ((TempElement.
Link[1] == 2) || (TempElement.
Link[1] == 4) || (TempElement.
Link[1] == 6) || (TempElement.
Link[1] == 8)))
12377 OnePlatList.push_back(TempElement.
Conn[1]);
12378 NamePosList.erase(NPLIt);
12381 OnePlatList.erase(OnePlatList.begin());
12382 if(OnePlatList.empty())
12385 if(!NamePosList.empty())
12387 OnePlatList.push_back(NamePosList.back());
12388 NamePosList.pop_back();
12404 throw Exception(
"Element at " + AnsiString(FPVIt->TVPos) +
" not signal in RepairFailedSignals");
12408 throw Exception(
"Signals not failed at " + AnsiString(FPVIt->TVPos) +
" in RepairFailedSignals");
12436 throw Exception(
"Element at " + AnsiString(FPVIt->TVPos) +
" not points in RepairFailedPoints");
12440 throw Exception(
"Points not failed at " + AnsiString(FPVIt->TVPos) +
" in RepairFailedPoints");
12466 throw Exception(
"Element at " + AnsiString(FPVIt->TVPos) +
" not simple in RepairFailedPoints");
12470 throw Exception(
"No TSR at " + AnsiString(FPVIt->TVPos) +
" in RepairTSR");
12492 for(
unsigned int x = 0; x <
TrackVector.size(); x++)
12511 throw Exception(
"Out of Range Error, vector size: " + AnsiString(
UserGraphicVector.size()) +
", At: " + AnsiString(At) +
" in UserGraphicVectorAt");
12526 throw Exception(
"Return value negative in call to LastElementNumber");
12538 throw Exception(
"PrefDirVector empty in call to LastElementPtr");
12552 throw Exception(
"Out of Range Error, vector size: " + AnsiString(
PrefDirVector.size()) +
", At: " + AnsiString(At) +
" in GetFixedPrefDirElementAt");
12564 throw Exception(
"Out of Range Error, vector size: " + AnsiString(
PrefDirVector.size()) +
", At: " + AnsiString(At) +
12565 " in GetModifiablePrefDirElementAt");
12575 if((At < 0) || ((
unsigned int)At >=
SearchVector.size()))
12577 throw Exception(
"Out of Range Error, vector size: " + AnsiString(
SearchVector.size()) +
", At: " + AnsiString(At) +
" in GetFixedSearchElementAt");
12587 if((At < 0) || ((
unsigned int)At >=
SearchVector.size()))
12589 throw Exception(
"Out of Range Error, vector size: " + AnsiString(
SearchVector.size()) +
", At: " + AnsiString(At) +
" in GetModifiableSearchElementAt");
12606 int TrackVectorPosition;
12657 FinishElement =
false;
12658 int TrackVectorPosition;
12680 if(TrackElement.
HLoc >= StartPrefDirElement.
HLoc)
12690 if(TrackElement.
VLoc >= StartPrefDirElement.
VLoc)
12713 for(
int x = 0; x < 4; x++)
12736 FinishElement =
true;
12744 for(
int x = 0; x < 4; x++)
12756 FinishElement =
true;
12764 "Unable to find a route to the selected element - may be unreachable, too far ahead, or invalid. Try selecting an end point closer to the start point.");
12771 .ELinkPos] ==
Lead))
12787 FinishElement =
true;
12806 FinishElement =
true;
12825 FinishElement =
true;
12840 FinishElement =
true;
12849 "Unable to find a route to the selected element - may be unreachable, too far ahead, or invalid. Try selecting an end point closer to the start point.");
12865 FinishElement =
true;
12871 "Unable to find a route to the selected element - may be unreachable, too far ahead, or invalid. Try selecting an end point closer to the start point.");
12894 AnsiString(XLinkPos) +
"," + AnsiString(RequiredPosition));
12895 int VectorCount = 0;
12899 if(CurrentTrackElement.
Config[XLinkPos] ==
End)
12901 for(
int x = 0; x < VectorCount; x++)
12908 int NextPosition = CurrentTrackElement.
Conn[XLinkPos];
12912 int NextELinkPos = CurrentTrackElement.
ConnLinkPos[XLinkPos];
12913 SearchElement.
ELinkPos = NextELinkPos;
12934 SearchElement.
XLink = SearchElement.
Link[NextXLinkPos];
12936 SearchElement.
XLinkPos = NextXLinkPos;
12962 for(
int x = 0; x < VectorCount; x++)
12974 for(
int x = 0; x < VectorCount; x++)
12988 for(
int x = 0; x < VectorCount; x++)
13002 for(
int x = 0; x < VectorCount; x++)
13012 for(
int x = 0; x < VectorCount; x++)
13023 SearchElement.
XLink = SearchElement.
Link[1];
13042 SearchElement.
XLink = SearchElement.
Link[3];
13055 for(
int x = 0; x < VectorCount; x++)
13070 XLinkPos = NextXLinkPos;
13071 CurrentTrackElement = SearchElement;
13090 throw Exception(
"Error, SearchVector empty");
13097 for(
int x = 0; x < 4; x++)
13150 throw Exception(
"Error in EntryExitNumber 1");
13169 if(PrefDirElement.
XLink == -1)
13181 if(PrefDirElement.
XLink != -1)
13185 throw Exception(
"Error in EntryExitNumber 2");
13223 LeadingPoints =
false;
13251 LeadingPoints =
true;
13267 AnsiString ErrorString;
13268 bool Error =
false;
13275 ErrorString =
"HLoc";
13281 ErrorString =
"VLoc";
13287 ErrorString =
"ELink";
13293 ErrorString =
"ELinkPos";
13299 ErrorString =
"XLink";
13305 ErrorString =
"XLinkPos";
13311 ErrorString =
"Tag";
13317 ErrorString =
"TrackVectorPosition";
13323 ErrorString =
"EXNumber";
13330 ErrorString =
"CheckCount";
13337 ErrorString =
"EntryGraphicPtr";
13343 ErrorString =
"EntryDirectionGraphicPtr";
13352 ErrorString =
"Last XLink not connected to this element";
13359 throw Exception(
"Error at " + AnsiString(Position) +
" " + ErrorString);
13383 for(
int PrefDirVecPos = (
PrefDirVector.size() - 1); PrefDirVecPos >= (int)x; PrefDirVecPos--)
13440 AnsiString((
short)BuildingPrefDir));
13443 if(PrefDirSize() == 0)
13448 for(
unsigned int x = 0; x < PrefDirSize(); x++)
13460 Disp->PlotOutput(12, (TempPrefDirElement.
HLoc * 16), (TempPrefDirElement.
VLoc * 16), TempPrefDirElement.
EXGraphicPtr);
13472 if(x == (PrefDirSize() - 1))
13481 if((PrefDirRoute ==
PrefDirCall) && BuildingPrefDir)
13483 HPos = GetFixedPrefDirElementAt(4, 0).
HLoc * 16;
13484 VPos = GetFixedPrefDirElementAt(5, 0).VLoc * 16;
13485 Disp->Rectangle(1, HPos, VPos,
clB0G0R5, 2, 2);
13487 if(PrefDirSize() > 1)
13489 unsigned int LatestPos = PrefDirSize() - 1;
13490 HPos = GetFixedPrefDirElementAt(6, LatestPos).HLoc * 16;
13491 VPos = GetFixedPrefDirElementAt(7, LatestPos).VLoc * 16;
13492 Disp->Rectangle(2, HPos, VPos,
clB5G0R0, 4, 2);
13513 int H, V, PrefDirPos0, PrefDirPos1, PrefDirPos2, PrefDirPos3;
13516 TPrefDirElement PrefDirElement0, PrefDirElement1, PrefDirElement2, PrefDirElement3;
13520 H = MMIT->first.first;
13521 V = MMIT->first.second;
13524 if(PrefDirPos0 > -1)
13528 if(PrefDirPos1 > -1)
13532 if(PrefDirPos2 > -1)
13536 if(PrefDirPos3 > -1)
13540 if(PrefDirPos3 > -1)
13556 else if(PrefDirPos2 > -1)
13598 else if(PrefDirPos1 > -1)
13621 else if(PrefDirPos0 > -1)
13640 int NumberOfPrefDirElements = 0;
13643 for(
int x = 0; x < NumberOfPrefDirElements; x++)
13645 VecFile >> TempInt;
13648 VecFile >> TempInt;
13649 LoadPrefDirElement.
ELink = TempInt;
13650 VecFile >> TempInt;
13651 LoadPrefDirElement.
ELinkPos = TempInt;
13652 VecFile >> TempInt;
13653 LoadPrefDirElement.
XLink = TempInt;
13654 VecFile >> TempInt;
13655 LoadPrefDirElement.
XLinkPos = TempInt;
13656 VecFile >> TempInt;
13657 LoadPrefDirElement.
EXNumber = TempInt;
13658 VecFile >> TempInt;
13663 if(!(LoadPrefDirElement.
IsARoute))
13689 int NumberOfPrefDirElements = 0;
13692 for(
int x = 0; x < NumberOfPrefDirElements; x++)
13694 VecFile >> TempInt;
13695 VecFile >> TempInt;
13698 VecFile >> TempInt;
13699 LoadPrefDirElement.
ELink = TempInt;
13700 VecFile >> TempInt;
13701 LoadPrefDirElement.
ELinkPos = TempInt;
13702 VecFile >> TempInt;
13703 LoadPrefDirElement.
XLink = TempInt;
13704 VecFile >> TempInt;
13705 LoadPrefDirElement.
XLinkPos = TempInt;
13706 VecFile >> TempInt;
13707 LoadPrefDirElement.
EXNumber = TempInt;
13708 VecFile >> TempInt;
13713 if(!(LoadPrefDirElement.
IsARoute))
13741 int NumberOfPrefDirElements = 0;
13744 if((NumberOfPrefDirElements < 0) || (NumberOfPrefDirElements > 1000000))
13749 for(
int x = 0; x < NumberOfPrefDirElements; x++)
13756 VecFile >> TempInt;
13757 if((TempInt < 0) || (TempInt >= NumberOfActiveElements))
13762 VecFile >> TempInt;
13763 if((TempInt < -1) || (TempInt > 9))
13768 VecFile >> TempInt;
13769 if((TempInt < -1) || (TempInt > 3))
13774 VecFile >> TempInt;
13775 if((TempInt < -1) || (TempInt > 9))
13780 VecFile >> TempInt;
13781 if((TempInt < -1) || (TempInt > 3))
13786 VecFile >> TempInt;
13787 if((TempInt < -1) || (TempInt > 27))
13792 VecFile >> TempInt;
13800 VecFile >> TempInt;
13801 if((TempInt != 0) && (TempInt != 1))
13806 VecFile >> TempInt;
13807 if((TempInt != 0) && (TempInt != 1))
13812 VecFile >> TempInt;
13813 if((TempInt != 0) && (TempInt != 1))
13836 for(
int y = 0; y < NumberOfPrefDirElements; y++)
13838 VecFile << y <<
'\n';
13839 VecFile <<
PrefDirVector.at(y).TrackVectorPosition <<
'\n';
13849 if(y == (NumberOfPrefDirElements - 1))
13851 VecFile <<
"************" <<
'\0' <<
'\n';
13855 VecFile <<
"******" <<
'\0' <<
'\n';
13869 for(
int y = 0; y < NumberOfSearchElements; y++)
13871 VecFile << y <<
'\n';
13872 VecFile <<
SearchVector.at(y).TrackVectorPosition <<
'\n';
13882 if(y == (NumberOfSearchElements - 1))
13884 VecFile <<
"************" <<
'\0' <<
'\n';
13888 VecFile <<
"******" <<
'\0' <<
'\n';
14001 bool AlreadyPresent, FoundFlag;
14002 int PrefDirPos0, PrefDirPos1, PrefDirPos2, PrefDirPos3;
14004 for(
unsigned int x = 0; x < InputPrefDir->
PrefDirSize(); x++)
14008 AlreadyPresent =
false;
14013 AlreadyPresent =
true;
14017 AlreadyPresent =
true;
14021 AlreadyPresent =
true;
14025 AlreadyPresent =
true;
14028 if(!AlreadyPresent)
14075 for(
unsigned int z = 0; z < 4; z++)
14083 throw Exception(
"Error in RebuildPrefDirVector - PrefDirVector is unsafe");
14097 bool DiscrepancyFound =
false;
14108 DiscrepancyFound =
true;
14113 DiscrepancyFound =
true;
14118 DiscrepancyFound =
true;
14123 DiscrepancyFound =
true;
14128 DiscrepancyFound =
true;
14134 DiscrepancyFound =
true;
14137 if(DiscrepancyFound)
14139 ShowMessage(
"Discrepancies found in the preferred direction file, preferred directions will be cleared");
14154 bool DiscrepancyFound =
false;
14165 DiscrepancyFound =
true;
14169 DiscrepancyFound =
true;
14174 DiscrepancyFound =
true;
14179 DiscrepancyFound =
true;
14184 DiscrepancyFound =
true;
14190 DiscrepancyFound =
true;
14194 return(!DiscrepancyFound);
14206 bool FoundFlag =
false;
14207 int PrefDir0, PrefDir1, PrefDir2, PrefDir3;
14215 throw Exception(
"CheckPrefDir4MultiMap Error - failed to find HLoc=" + (AnsiString)CheckElement.
HLoc +
" VLoc=" + (AnsiString)CheckElement.
VLoc +
14216 " in PrefDir4MultiMap, Caller=" + (AnsiString)Caller);
14218 if((PrefDir0 != (
int)a) && (PrefDir1 != (
int)a) && (PrefDir2 != (
int)a) && (PrefDir3 != (
int)a))
14220 throw Exception(
"CheckPrefDir4MultiMap Error - MapVectorPosition failed at HLoc=" + (AnsiString)CheckElement.
HLoc +
" VLoc=" +
14221 (AnsiString)CheckElement.
VLoc +
" Map values=" + (AnsiString)PrefDir0 +
", " + (AnsiString)PrefDir1 +
", " + (AnsiString)PrefDir2 +
", " +
14222 (AnsiString)PrefDir3 +
" PrefDirVectorPos value=" + (AnsiString)a +
" Caller=" + (AnsiString)Caller);
14227 throw Exception(
"CheckPrefDir4MultiMap Error - Map Size=" + (AnsiString)
PrefDirVector.size() +
" PrefDirVectorSize=" + (AnsiString)
PrefDirVector.size()
14228 +
" Caller=" + (AnsiString)Caller);
14254 PrefDirMapKeyPair.first = HLoc;
14255 PrefDirMapKeyPair.second = VLoc;
14256 std::pair<TPrefDir4MultiMapIterator, TPrefDir4MultiMapIterator>ItPair;
14259 if(ItPair.first == ItPair.second)
14267 PrefDirPos0 = ItPair.first->second;
14269 if(ItPair.first == ItPair.second)
14274 if(((ItPair.first->first).first == HLoc) && ((ItPair.first->first).second == VLoc))
14276 PrefDirPos1 = ItPair.first->second;
14279 if(ItPair.first == ItPair.second)
14284 if(((ItPair.first->first).first == HLoc) && ((ItPair.first->first).second == VLoc))
14286 PrefDirPos2 = ItPair.first->second;
14289 if(ItPair.first == ItPair.second)
14294 if(((ItPair.first->first).first == HLoc) && ((ItPair.first->first).second == VLoc))
14296 PrefDirPos3 = ItPair.first->second;
14311 +
"," + AnsiString(LinkNumberPos));
14313 int PD0, PD1, PD2, PD3;
14314 if(
PrefDirVector.at(PrefDirVectorNumber).Conn[LinkNumberPos] > -1)
14318 PD0, PD1, PD2, PD3);
14330 LinkedPrefDirVectorNumber = PD0;
14339 LinkedPrefDirVectorNumber = PD1;
14349 LinkedPrefDirVectorNumber = PD0;
14358 LinkedPrefDirVectorNumber = PD1;
14367 LinkedPrefDirVectorNumber = PD2;
14376 LinkedPrefDirVectorNumber = PD3;
14381 LinkedPrefDirVectorNumber = -1;
14387 LinkedPrefDirVectorNumber = -1;
14392 catch(
const Exception &e)
14394 LinkedPrefDirVectorNumber = -1;
14409 +
"," + AnsiString(LinkNumberPos));
14411 int PD0, PD1, PD2, PD3;
14412 if(
PrefDirVector.at(PrefDirVectorNumber).Conn[LinkNumberPos] > -1)
14416 PD0, PD1, PD2, PD3);
14429 LinkedPrefDirVectorNumber = PD0;
14439 LinkedPrefDirVectorNumber = PD1;
14444 LinkedPrefDirVectorNumber = -1;
14452 LinkedPrefDirVectorNumber = PD0;
14461 LinkedPrefDirVectorNumber = PD1;
14470 LinkedPrefDirVectorNumber = PD2;
14479 LinkedPrefDirVectorNumber = PD3;
14484 LinkedPrefDirVectorNumber = -1;
14490 LinkedPrefDirVectorNumber = -1;
14495 catch(
const Exception &e)
14497 LinkedPrefDirVectorNumber = -1;
14509 int PD0, PD1, PD2, PD3;
14561 THVPair PrefDir4MultiMapKeyPair;
14564 PrefDir4MultiMapKeyPair.first = LoadPrefDirElement.
HLoc;
14565 PrefDir4MultiMapKeyPair.second = LoadPrefDirElement.
VLoc;
14566 PrefDir4MultiMapEntry.first = PrefDir4MultiMapKeyPair;
14589 throw Exception(
"Failed to find PrefDir4MultiMap erase element");
14608 AnsiString(ErasedElementNumber));
14613 if(MapPtr->second > ErasedElementNumber)
14635 throw Exception(
"PrefDirVectorPosition out of range");
14638 THVPair PrefDir4MultiMapKeyPair;
14640 PrefDir4MultiMapKeyPair.first = PrefDirElement.
HLoc;
14641 PrefDir4MultiMapKeyPair.second = PrefDirElement.
VLoc;
14642 std::pair<TPrefDir4MultiMapIterator, TPrefDir4MultiMapIterator>ItPair;
14645 if(ItPair.first == ItPair.second)
14648 return(ItPair.first);
14652 if(ItPair.first->second == PrefDirVectorPosition)
14656 return(ItPair.first);
14659 if(ItPair.first == ItPair.second)
14662 return(ItPair.first);
14664 if(ItPair.first->second == PrefDirVectorPosition)
14668 return(ItPair.first);
14671 if(ItPair.first == ItPair.second)
14674 return(ItPair.first);
14676 if(ItPair.first->second == PrefDirVectorPosition)
14680 return(ItPair.first);
14683 if(ItPair.first == ItPair.second)
14686 return(ItPair.first);
14688 if(ItPair.first->second == PrefDirVectorPosition)
14692 return(ItPair.first);
14696 return(ItPair.first);
14709 THVPair PrefDir4MultiMapKeyPair;
14711 PrefDir4MultiMapKeyPair.first = HLoc;
14712 PrefDir4MultiMapKeyPair.second = VLoc;
14713 std::pair<TPrefDir4MultiMapIterator, TPrefDir4MultiMapIterator>ItPair;
14716 if(ItPair.first == ItPair.second)
14724 return(ItPair.first->second);
14733 bool ErasedFlag =
false;
14735 if(ErasedTrackVectorPosition > -1)
14744 ErasedFlag =
false;
14746 if(
PrefDirVector.at(x).TrackVectorPosition == ErasedTrackVectorPosition)
14751 else if(
PrefDirVector.at(x).Conn[0] == ErasedTrackVectorPosition)
14756 else if(
PrefDirVector.at(x).Conn[1] == ErasedTrackVectorPosition)
14761 else if(
PrefDirVector.at(x).Conn[2] == ErasedTrackVectorPosition)
14766 else if(
PrefDirVector.at(x).Conn[3] == ErasedTrackVectorPosition)
14774 if(
PrefDirVector.at(x).TrackVectorPosition > ErasedTrackVectorPosition)
14778 if(
PrefDirVector.at(x).Conn[0] > ErasedTrackVectorPosition)
14782 if(
PrefDirVector.at(x).Conn[1] > ErasedTrackVectorPosition)
14786 if(
PrefDirVector.at(x).Conn[2] > ErasedTrackVectorPosition)
14790 if(
PrefDirVector.at(x).Conn[3] > ErasedTrackVectorPosition)
14805 OverallDistance = 0;
14806 OverallSpeedLimit = 0;
14807 LeadingPointsAtLastElement =
false;
14815 LeadingPointsAtLastElement =
true;
14824 OverallDistance += PrefDirElement.
Length23;
14825 if(OverallSpeedLimit != -1)
14835 OverallSpeedLimit = -1;
14842 OverallDistance += PrefDirElement.
Length01;
14843 if(OverallSpeedLimit != -1)
14853 OverallSpeedLimit = -1;
14872 int H, V, HLoc, VLoc, PrefDirPos0, PrefDirPos1, PrefDirPos2, PrefDirPos3;
14875 TPrefDirElement PrefDirElement0, PrefDirElement1, PrefDirElement2, PrefDirElement3;
14879 HLoc = MMIT->first.first;
14880 VLoc = MMIT->first.second;
14885 if(PrefDirPos0 > -1)
14889 if(PrefDirPos1 > -1)
14893 if(PrefDirPos2 > -1)
14897 if(PrefDirPos3 > -1)
14901 if(PrefDirPos3 > -1)
14904 Bitmap->Canvas->Draw((H * 16), (V * 16), PrefDirElement0.
GetRouteGraphicPtr(
false,
true));
14906 Bitmap->Canvas->Draw((H * 16), (V * 16), PrefDirElement1.
GetRouteGraphicPtr(
false,
true));
14908 Bitmap->Canvas->Draw((H * 16), (V * 16), PrefDirElement2.
GetRouteGraphicPtr(
false,
true));
14910 Bitmap->Canvas->Draw((H * 16), (V * 16), PrefDirElement3.
GetRouteGraphicPtr(
false,
true));
14917 else if(PrefDirPos2 > -1)
14922 Bitmap->Canvas->Draw((H * 16), (V * 16), PrefDirElement0.
GetRouteGraphicPtr(
false,
true));
14924 Bitmap->Canvas->Draw((H * 16), (V * 16), PrefDirElement1.
GetRouteGraphicPtr(
false,
true));
14926 Bitmap->Canvas->Draw((H * 16), (V * 16), PrefDirElement2.
GetRouteGraphicPtr(
false,
false));
14935 Bitmap->Canvas->Draw((H * 16), (V * 16), PrefDirElement0.
GetRouteGraphicPtr(
false,
true));
14937 Bitmap->Canvas->Draw((H * 16), (V * 16), PrefDirElement2.
GetRouteGraphicPtr(
false,
true));
14939 Bitmap->Canvas->Draw((H * 16), (V * 16), PrefDirElement1.
GetRouteGraphicPtr(
false,
false));
14948 Bitmap->Canvas->Draw((H * 16), (V * 16), PrefDirElement1.
GetRouteGraphicPtr(
false,
true));
14950 Bitmap->Canvas->Draw((H * 16), (V * 16), PrefDirElement2.
GetRouteGraphicPtr(
false,
true));
14952 Bitmap->Canvas->Draw((H * 16), (V * 16), PrefDirElement0.
GetRouteGraphicPtr(
false,
false));
14959 else if(PrefDirPos1 > -1)
14964 Bitmap->Canvas->Draw((H * 16), (V * 16), PrefDirElement0.
GetRouteGraphicPtr(
false,
true));
14966 Bitmap->Canvas->Draw((H * 16), (V * 16), PrefDirElement1.
GetRouteGraphicPtr(
false,
true));
14974 Bitmap->Canvas->Draw((H * 16), (V * 16), PrefDirElement0.
GetRouteGraphicPtr(
false,
false));
14976 Bitmap->Canvas->Draw((H * 16), (V * 16), PrefDirElement1.
GetRouteGraphicPtr(
false,
false));
14982 else if(PrefDirPos0 > -1)
14984 Bitmap->Canvas->Draw((H * 16), (V * 16), PrefDirElement0.
GetRouteGraphicPtr(
false,
false));
15001 int PrefDirPos0, PrefDirPos1, PrefDirPos2, PrefDirPos3;
15004 TPrefDirElement PrefDirElement0, PrefDirElement1, PrefDirElement2, PrefDirElement3;
15026 if(PrefDirPos0 > -1)
15030 if(PrefDirPos1 > -1)
15034 if(PrefDirPos2 > -1)
15038 if(PrefDirPos3 > -1)
15042 if(PrefDirPos3 > -1)
15047 else if(PrefDirPos2 > -1)
15049 if((PrefDirElement0.
XLinkPos == EntryPos) || (PrefDirElement1.
XLinkPos == EntryPos) || (PrefDirElement2.
XLinkPos == EntryPos))
15060 else if(PrefDirPos1 > -1)
15062 if((PrefDirElement0.
XLinkPos == EntryPos) || (PrefDirElement1.
XLinkPos == EntryPos))
15073 else if(PrefDirPos0 > -1)
15075 if(PrefDirElement0.
XLinkPos == EntryPos)
15112 ElementIn.
VLoc +
"," + XLink);
15114 bool TrackFoundFlag;
15117 if((XLink == 2) || (XLink == 4) || (XLink == 6) || (XLink == 8))
15129 if((TempTrackElement.
Link[0] == 3) || (TempTrackElement.
Link[1] == 3) || (TempTrackElement.
Link[2] == 3) || (TempTrackElement.
Link[3] == 3))
15139 if((TempTrackElement.
Link[0] == 7) || (TempTrackElement.
Link[1] == 7) || (TempTrackElement.
Link[2] == 7) || (TempTrackElement.
Link[3] == 7))
15153 if((TempTrackElement.
Link[0] == 1) || (TempTrackElement.
Link[1] == 1) || (TempTrackElement.
Link[2] == 1) || (TempTrackElement.
Link[3] == 1))
15163 if((TempTrackElement.
Link[0] == 9) || (TempTrackElement.
Link[1] == 9) || (TempTrackElement.
Link[2] == 9) || (TempTrackElement.
Link[3] == 9))
15177 if((TempTrackElement.
Link[0] == 9) || (TempTrackElement.
Link[1] == 9) || (TempTrackElement.
Link[2] == 9) || (TempTrackElement.
Link[3] == 9))
15187 if((TempTrackElement.
Link[0] == 1) || (TempTrackElement.
Link[1] == 1) || (TempTrackElement.
Link[2] == 1) || (TempTrackElement.
Link[3] == 1))
15201 if((TempTrackElement.
Link[0] == 7) || (TempTrackElement.
Link[1] == 7) || (TempTrackElement.
Link[2] == 7) || (TempTrackElement.
Link[3] == 7))
15211 if((TempTrackElement.
Link[0] == 3) || (TempTrackElement.
Link[1] == 3) || (TempTrackElement.
Link[2] == 3) || (TempTrackElement.
Link[3] == 3))
15234 bool FoundFlag, ContFlag, FoundElements =
false;
15235 int PrefDirPos0, PrefDirPos1, PrefDirPos2, PrefDirPos3;
15240 LastIteratorValue++;
15266 if(PDVIt->XLinkPos == 0)
15271 StartElement = *PDVIt;
15280 int NextTrackVectorPosition = PDVIt->
Conn[PDVIt->GetXLinkPos()];
15282 Track->
TrackElementAt(879, NextTrackVectorPosition).
VLoc, FoundFlag, PrefDirPos0, PrefDirPos1, PrefDirPos2, PrefDirPos3);
15283 if(PrefDirPos0 == -1)
15287 bool NextElementFoundFlag =
false;
15291 NextElementFoundFlag =
true;
15293 if(PrefDirPos1 > -1)
15298 NextElementFoundFlag =
true;
15301 if(PrefDirPos2 > -1)
15306 NextElementFoundFlag =
true;
15309 if(PrefDirPos3 > -1)
15314 NextElementFoundFlag =
true;
15317 if(!NextElementFoundFlag)
15347 EndElement = NextElement;
15351 NextTrackVectorPosition = NextElement.
Conn[NextElement.
GetXLinkPos()];
15353 Track->
TrackElementAt(881, NextTrackVectorPosition).
VLoc, FoundFlag, PrefDirPos0, PrefDirPos1, PrefDirPos2, PrefDirPos3);
15354 if(PrefDirPos0 == -1)
15364 if(PrefDirPos1 > -1)
15372 if(PrefDirPos2 > -1)
15380 if(PrefDirPos3 > -1)
15411 FoundElements =
true;
15445 AnsiString(VLoc) +
"," + AnsiString((
short)AutoSigsFlag));
15447 int TrackVectorPosition;
15483 int LockedVectorNumber;
15506 bool InPrefDirFlag =
false;
15509 int PrefDirPos0 = -1;
15510 int PrefDirPos1 = -1;
15511 int PrefDirPos2 = -1;
15512 int PrefDirPos3 = -1;
15516 int PrefDirVecPos[4] =
15518 PrefDirPos0, PrefDirPos1, PrefDirPos2, PrefDirPos3
15521 for(
int x = 0; x < 4; x++)
15523 int b = PrefDirVecPos[x];
15533 InPrefDirFlag =
true;
15546 TrainController->
StopTTClockMessage(12,
"Route and preferred direction mismatch. If no preferred direction then only red routes can be used. Green and blue route directions must correspond to the preferred direction.");
15554 if(DummyPair.first > -1)
15556 throw Exception(
"Selection in two routes - should never happen!");
15558 if(RoutePair.first > -1)
15634 IDInt &ReqPosRouteID,
bool &PointsChanged)
15668 AnsiString(VLoc) +
"," + AnsiString((
short)ConsecSignals) +
"," + AnsiString((
short)AutoSigsFlag));
15670 int NewFailedPointsTVPos = -1;
15719 bool InPrefDirFlag =
false;
15722 int PrefDirPos0 = -1;
15723 int PrefDirPos1 = -1;
15724 int PrefDirPos2 = -1;
15725 int PrefDirPos3 = -1;
15728 PrefDirPos0, PrefDirPos1, PrefDirPos2, PrefDirPos3);
15729 int PrefDirVecPos[4] =
15731 PrefDirPos0, PrefDirPos1, PrefDirPos2, PrefDirPos3
15734 for(
int x = 0; x < 4; x++)
15736 int b = PrefDirVecPos[x];
15739 InPrefDirFlag =
true;
15752 TrainController->
StopTTClockMessage(23,
"Route and preferred direction mismatch. If no preferred direction then only red routes can be used. Green and blue route directions must correspond to the preferred direction.");
15761 if(RoutePair.first > -1)
15763 if(RoutePair.second != 0)
15780 EndElement1 = RouteElement;
15781 EndElement2 = BlankElement;
15876 AutoSigsFlag,
false))
15881 if(NewFailedPointsTVPos > -1)
15885 " failed during route setting.");
15889 PointsChanged =
true;
15912 AutoSigsFlag,
false))
15917 if(NewFailedPointsTVPos > -1)
15921 " failed during route setting.");
15925 PointsChanged =
true;
15943 AutoSigsFlag,
false))
15948 if(NewFailedPointsTVPos > -1)
15952 " failed during route setting.");
15956 PointsChanged =
true;
15980 AutoSigsFlag,
false))
15985 if(NewFailedPointsTVPos > -1)
15989 " failed during route setting.");
15993 PointsChanged =
true;
16002 AutoSigsFlag,
false))
16007 if(NewFailedPointsTVPos > -1)
16011 " failed during route setting.");
16015 PointsChanged =
true;
16026 AutoSigsFlag,
false))
16031 if(NewFailedPointsTVPos > -1)
16035 " failed during route setting.");
16039 PointsChanged =
true;
16045 AutoSigsFlag,
false))
16050 if(NewFailedPointsTVPos > -1)
16054 " failed during route setting.");
16058 PointsChanged =
true;
16069 AutoSigsFlag,
false))
16074 if(NewFailedPointsTVPos > -1)
16078 " failed during route setting.");
16082 PointsChanged =
true;
16136 TOnePrefDir *EveryPrefDir,
bool ConsecSignals,
int EndPosition,
bool AutoSigsFlag,
bool RecursiveCall)
16188 AnsiString(XLinkPos) +
"," + AnsiString(RequiredPosition) +
"," + AnsiString(
ReqPosRouteID.
GetInt()) +
"," + AnsiString(EndPosition) +
"," +
16189 AnsiString((
short)AutoSigsFlag) +
"," + AnsiString((
short)RecursiveCall));
16190 int VectorCount = 0;
16199 if((PrefDirElement.
XLink == 1) || (PrefDirElement.
XLink == 3) || (PrefDirElement.
XLink == 7) || (PrefDirElement.
XLink == 9))
16203 for(
int x = 0; x < VectorCount; x++)
16211 bool FirstPass =
true;
16221 for(
int x = 0; x < VectorCount; x++)
16230 for(
int x = 0; x < VectorCount; x++)
16242 for(
int x = 0; x < VectorCount; x++)
16250 int NextPosition = PrefDirElement.
Conn[XLinkPos];
16254 int NextELinkPos = PrefDirElement.
ConnLinkPos[XLinkPos];
16255 SearchElement.
ELinkPos = NextELinkPos;
16256 SearchElement.
ELink = SearchElement.
Link[NextELinkPos];
16277 SearchElement.
XLink = SearchElement.
Link[NextXLinkPos];
16279 SearchElement.
XLinkPos = NextXLinkPos;
16297 for(
int x = 0; x < VectorCount; x++)
16313 for(
int x = 0; x < VectorCount; x++)
16327 if(RoutePair.first > -1)
16336 for(
int x = 0; x < VectorCount; x++)
16345 if(SecondPair.first > -1)
16354 for(
int x = 0; x < VectorCount; x++)
16368 for(
int x = 0; x < VectorCount; x++)
16379 for(
int x = 0; x < VectorCount; x++)
16388 for(
int x = 0; x < VectorCount; x++)
16397 if((SearchElement.
XLink == 1) || (SearchElement.
XLink == 3) || (SearchElement.
XLink == 7) || (SearchElement.
XLink == 9))
16401 for(
int x = 0; x < VectorCount; x++)
16411 bool InPrefDirFlag =
false;
16412 PrefDirElement1 = BlankElement;
16413 PrefDirElement2 = BlankElement;
16416 int PrefDirPos0 = -1;
16417 int PrefDirPos1 = -1;
16418 int PrefDirPos2 = -1;
16419 int PrefDirPos3 = -1;
16422 int PrefDirVecPos[4] =
16424 PrefDirPos0, PrefDirPos1, PrefDirPos2, PrefDirPos3
16426 for(
int x = 0; x < 4; x++)
16428 int b = PrefDirVecPos[x];
16431 InPrefDirFlag =
true;
16444 for(
int x = 0; x < VectorCount; x++)
16456 for(
int x = 0; x < VectorCount; x++)
16472 for(
int x = 0; x < VectorCount; x++)
16483 for(
int x = 0; x < VectorCount; x++)
16503 for(
int x = 0; x < VectorCount; x++)
16516 for(
int x = 0; x < VectorCount; x++)
16530 for(
int x = 0; x < VectorCount; x++)
16540 for(
int x = 0; x < VectorCount; x++)
16571 for(
int x = 0; x < VectorCount; x++)
16580 for(
int x = 0; x < VectorCount; x++)
16592 int SearchPos1 = SearchElement.
Attribute + 1;
16594 if(SearchPos1 == 2)
16598 if(SearchPos1 == 1)
16606 SearchElement.
XLink = SearchElement.
Link[SearchPos1];
16607 SearchElement.
XLinkPos = SearchPos1;
16608 InPrefDirFlag =
false;
16609 if(SearchElement.
XLink == PrefDirElement1.
XLink)
16611 SearchElement = PrefDirElement1;
16612 InPrefDirFlag =
true;
16614 else if(SearchElement.
XLink == PrefDirElement2.
XLink)
16616 SearchElement = PrefDirElement2;
16617 InPrefDirFlag =
true;
16623 if((SearchElement.
XLink == 1) || (SearchElement.
XLink == 3) || (SearchElement.
XLink == 7) || (SearchElement.
XLink == 9))
16627 for(
int x = 0; x < VectorCount; x++)
16645 AutoSigsFlag,
true))
16654 for(
int x = 0; x < VectorCount; x++)
16663 for(
int x = 0; x < VectorCount; x++)
16683 for(
int x = 0; x < VectorCount; x++)
16693 SearchElement.
XLink = SearchElement.
Link[SearchPos2];
16694 SearchElement.
XLinkPos = SearchPos2;
16695 if(SearchElement.
XLink == PrefDirElement1.
XLink)
16697 SearchElement = PrefDirElement1;
16699 else if(SearchElement.
XLink == PrefDirElement2.
XLink)
16701 SearchElement = PrefDirElement2;
16705 for(
int x = 0; x < VectorCount; x++)
16713 if((SearchElement.
XLink == 1) || (SearchElement.
XLink == 3) || (SearchElement.
XLink == 7) || (SearchElement.
XLink == 9))
16717 for(
int x = 0; x < VectorCount; x++)
16736 AutoSigsFlag,
true))
16745 for(
int x = 0; x < VectorCount; x++)
16754 for(
int x = 0; x < VectorCount; x++)
16766 for(
int x = 0; x < VectorCount; x++)
16776 SearchElement = PrefDirElement1;
16785 XLinkPos = SearchElement.
XLinkPos;
16786 PrefDirElement = SearchElement;
16843 unsigned int TruncatePrefDirPosition = 0;
16916 throw Exception(
"Error - failed to validate extended route for preferred route");
16971 throw Exception(
"Error - failed to validate single route for preferred route");
17016 AnsiString(VLoc) +
"," + AnsiString((
short)Callon));
17018 int TrackVectorPosition;
17055 int LockedVectorNumber;
17089 PrefDirElement1.
ELink = PrefDirElement1.
Link[0];
17090 PrefDirElement1.
XLink = PrefDirElement1.
Link[1];
17093 throw Exception(
"Error, No EXNumber for PrefDirElement1 in GetNonPreferredRouteStartElement");
17099 PrefDirElement2.
ELink = PrefDirElement2.
Link[1];
17100 PrefDirElement2.
XLink = PrefDirElement2.
Link[0];
17103 throw Exception(
"Error, No EXNumber for PrefDirElement2 in GetNonPreferredRouteStartElement");
17117 if(RoutePair.first > -1)
17252 int NewFailedPointsTVPos = -1;
17317 EndElement1.
ELink = EndElement1.
Link[0];
17318 EndElement1.
XLink = EndElement1.
Link[1];
17321 throw Exception(
"Error, No EXNumber for EndElement1 in GetNonPreferredRouteStartElement");
17326 EndElement2.
ELink = EndElement2.
Link[1];
17327 EndElement2.
XLink = EndElement2.
Link[0];
17330 throw Exception(
"Error, No EXNumber for EndElement2 in GetNonPreferredRouteStartElement");
17374 if(RoutePair.first > -1)
17376 if(RoutePair.second != 0)
17399 EndElement2 = BlankElement;
17484 if(NewFailedPointsTVPos > -1)
17488 " failed during route setting.");
17492 PointsChanged =
true;
17518 if(NewFailedPointsTVPos > -1)
17522 " failed during route setting.");
17526 PointsChanged =
true;
17548 if(NewFailedPointsTVPos > -1)
17552 " failed during route setting.");
17556 PointsChanged =
true;
17582 if(NewFailedPointsTVPos > -1)
17586 " failed during route setting.");
17590 PointsChanged =
true;
17604 if(NewFailedPointsTVPos > -1)
17608 " failed during route setting.");
17612 PointsChanged =
true;
17652 AnsiString(XLinkPos) +
"," + AnsiString(RequiredPosition) +
"," + AnsiString() +
"," + AnsiString(
ReqPosRouteID.
GetInt()));
17653 int VectorCount = 0;
17656 if((CurrentTrackElement.
Link[XLinkPos] == 1) || (CurrentTrackElement.
Link[XLinkPos] == 3) || (CurrentTrackElement.
Link[XLinkPos] == 7) ||
17657 (CurrentTrackElement.
Link[XLinkPos] == 9))
17661 for(
int x = 0; x < VectorCount; x++)
17673 for(
int x = 0; x < VectorCount; x++)
17680 if(CurrentTrackElement.
Config[XLinkPos] ==
End)
17682 for(
int x = 0; x < VectorCount; x++)
17689 int NextPosition = CurrentTrackElement.
Conn[XLinkPos];
17693 int NextELinkPos = CurrentTrackElement.
ConnLinkPos[XLinkPos];
17694 SearchElement.
ELinkPos = NextELinkPos;
17715 SearchElement.
XLink = SearchElement.
Link[NextXLinkPos];
17717 SearchElement.
XLinkPos = NextXLinkPos;
17735 for(
int x = 0; x < VectorCount; x++)
17751 for(
int x = 0; x < VectorCount; x++)
17765 if(RoutePair.first > -1)
17774 for(
int x = 0; x < VectorCount; x++)
17783 if(SecondPair.first > -1)
17792 for(
int x = 0; x < VectorCount; x++)
17806 for(
int x = 0; x < VectorCount; x++)
17817 for(
int x = 0; x < VectorCount; x++)
17826 for(
int x = 0; x < VectorCount; x++)
17835 if((SearchElement.
XLink == 1) || (SearchElement.
XLink == 3) || (SearchElement.
XLink == 7) || (SearchElement.
XLink == 9))
17839 for(
int x = 0; x < VectorCount; x++)
17852 for(
int x = 0; x < VectorCount; x++)
17880 for(
int x = 0; x < VectorCount; x++)
17893 for(
int x = 0; x < VectorCount; x++)
17903 for(
int x = 0; x < VectorCount; x++)
17928 for(
int x = 0; x < VectorCount; x++)
17937 for(
int x = 0; x < VectorCount; x++)
17950 int SearchPos1 = SearchElement.
Attribute + 1;
17952 if(SearchPos1 == 2)
17956 if(SearchPos1 == 1)
17965 SearchElement.
XLink = SearchElement.
Link[SearchPos1];
17966 SearchElement.
XLinkPos = SearchPos1;
17968 if((SearchElement.
XLink == 1) || (SearchElement.
XLink == 3) || (SearchElement.
XLink == 7) || (SearchElement.
XLink == 9))
17972 for(
int x = 0; x < VectorCount; x++)
17990 for(
int x = 0; x < VectorCount; x++)
18006 SearchElement.
XLink = SearchElement.
Link[SearchPos2];
18007 SearchElement.
XLinkPos = SearchPos2;
18009 if((SearchElement.
XLink == 1) || (SearchElement.
XLink == 3) || (SearchElement.
XLink == 7) || (SearchElement.
XLink == 9))
18013 for(
int x = 0; x < VectorCount; x++)
18029 for(
int x = 0; x < VectorCount; x++)
18041 for(
int x = 0; x < VectorCount; x++)
18056 CurrentTrackElement = SearchElement;
18057 XLinkPos = SearchElement.
XLinkPos;
18079 throw Exception(
"Error, SearchVector empty");
18091 for(
int x = 0; x < 4; x++)
18133 throw Exception(
"Error in EntryExitNumber 3");
18188 unsigned int TruncatePrefDirPosition = 0;
18248 throw Exception(
"Failed to validate extended route for nonpreferred route");
18293 throw Exception(
"Failed to validate single route for nonpreferred route");
18313 if(!PrefDirVector.empty())
18317 if((PrefDirPtr->TrackType ==
Points) && ((PrefDirPtr->ELinkPos == 1) || (PrefDirPtr->XLinkPos == 1)))
18322 if((PrefDirPtr->TrackType ==
Points) && ((PrefDirPtr->ELinkPos == 3) || (PrefDirPtr->XLinkPos == 3)))
18339 if(!PrefDirVector.empty())
18344 GetFixedPrefDirElementAt(193, 0).XLinkPos, RouteNumber);
18361 NewFailedPointsTVPos = -1;
18362 bool PointsChanged =
false;
18370 if((SearchPtr->TrackType ==
Points) && ((SearchPtr->ELinkPos == 1) || (SearchPtr->XLinkPos == 1)))
18380 NewFailedPointsTVPos = SearchPtr->TrackVectorPosition;
18381 IFE.
TVPos = NewFailedPointsTVPos;
18400 PointsChanged =
true;
18403 if((SearchPtr->TrackType ==
Points) && ((SearchPtr->ELinkPos == 3) || (SearchPtr->XLinkPos == 3)))
18413 NewFailedPointsTVPos = SearchPtr->TrackVectorPosition;
18414 IFE.
TVPos = NewFailedPointsTVPos;
18433 PointsChanged =
true;
18439 return(PointsChanged);
18463 NextForwardLinkedRouteNumber = -1;
18464 for(
unsigned int x = StartPos; x < PrefDirSize(); x++)
18466 int TrainID =
Track->
TrackElementAt(100, PrefDirVector.at(x).TrackVectorPosition).TrainIDOnElement;
18467 if(PrefDirVector.at(x).TrackType ==
Bridge)
18469 if(PrefDirVector.at(x).XLinkPos < 2)
18471 TrainID =
Track->
TrackElementAt(101, PrefDirVector.at(x).TrackVectorPosition).TrainIDOnBridgeOrFailedPointOrigSpeedLimit01;
18475 TrainID =
Track->
TrackElementAt(102, PrefDirVector.at(x).TrackVectorPosition).TrainIDOnBridgeOrFailedPointOrigSpeedLimit23;
18483 if(PrefDirVector.at(x).TrackType ==
Buffers)
18495 if(
Track->
IsLCAtHV(42, PrefDirVector.at(x).HLoc, PrefDirVector.at(x).VLoc))
18504 if(PrefDirVector.at(x).Config[PrefDirVector.at(x).XLinkPos] ==
Signal)
18506 Attribute =
Track->
TrackElementAt(103, PrefDirVector.at(x).TrackVectorPosition).Attribute;
18518 if(x == PrefDirSize() - 1)
18521 NextForwardLinkedRouteNumber = -1;
18569 AnsiString(PrefDirVectorStartPosition));
18575 if(!PrefDirVector.empty())
18577 if(!SkipForwardLook)
18579 for(
TPrefDirVectorConstIterator PrefDirPtr = (PrefDirVector.begin() + PrefDirVectorStartPosition); PrefDirPtr < PrefDirVector.end(); PrefDirPtr++)
18582 if(PrefDirPtr->TrackType ==
Bridge)
18584 if(PrefDirPtr->XLinkPos < 2)
18595 SkipForwardLook =
true;
18603 SkipForwardLook =
true;
18606 int NextForwardLinkedRouteNumber = -1;
18607 if((
unsigned int)PrefDirVectorStartPosition == PrefDirSize() - 1)
18609 TPrefDirElement PDE = GetFixedPrefDirElementAt(267, PrefDirVectorStartPosition);
18614 SkipForwardLook =
true;
18615 if(PrefDirVector.back().TrackType ==
Buffers)
18621 bool SetAttributeTo3 =
true;
18632 SetAttributeTo3 =
false;
18633 Attribute = AutoSigVectorIT->AccessNumber;
18639 if(SetAttributeTo3)
18650 SkipForwardLook =
true;
18651 if(PrefDirVector.back().TrackType ==
Buffers)
18664 if(!SkipForwardLook)
18669 if((
unsigned int)PrefDirVectorStartPosition < (PrefDirSize() - 1))
18671 StartPos = PrefDirVectorStartPosition + 1;
18679 if(!FindForwardTargetSignalAttribute(2, NextForwardLinkedRouteNumber, Attribute, StartPos))
18698 for(
TPrefDirVectorConstIterator PrefDirPtr = (PrefDirVector.begin() + PrefDirVectorStartPosition); PrefDirPtr >= PrefDirVector.begin(); PrefDirPtr--)
18701 if(PrefDirPtr->TrackType ==
Bridge)
18703 if(PrefDirPtr->XLinkPos < 2)
18719 if(
Track->
IsLCAtHV(20, PrefDirPtr->HLoc, PrefDirPtr->VLoc))
18728 if(PrefDirPtr->Config[PrefDirPtr->XLinkPos] ==
Signal)
18730 if((!
AllRoutes->
RouteTruncateFlag) || (PrefDirPtr != (PrefDirVector.begin() + PrefDirVectorStartPosition)) || PrefDirPtr->AutoSignals ||
18731 PrefDirPtr->PrefDirRoute)
18735 int LockedVecNum = 0;
18737 bool KeepAttributeAt0ForLockedRoute =
false;
18742 KeepAttributeAt0ForLockedRoute =
true;
18747 bool NotGroundSignal =
false;
18750 NotGroundSignal =
true;
18775 if((Attribute < 3) && !KeepAttributeAt0ForLockedRoute && (NotGroundSignal || (Attribute == 0)))
18806 "," + AnsiString((
short)PrefDirRoute));
18807 bool ElementInRoute =
false;
18809 int LastElementToBeTruncated = -1;
18810 bool MovingTrainOccupyingRoute =
false;
18811 unsigned int TruncatePDElementPos;
18812 enum {NoTruncate, BackTruncate, FrontTruncate, NextSignalTruncate, FullTruncate} TruncateType;
18813 TruncateType = NoTruncate;
18820 TruncatePDElementPos = b;
18821 ElementInRoute =
true;
18825 if(!ElementInRoute)
18851 if(TruncatePDElementPos == 0)
18853 TruncateType = FullTruncate;
18864 TruncateType = FrontTruncate;
18872 TruncatePDElementPos++;
18875 for(b =
int(TruncatePDElementPos); b < int(
PrefDirSize()); b++)
18880 TruncateType = NextSignalTruncate;
18887 TruncateType = BackTruncate;
18893 TruncateType = BackTruncate;
18901 TruncateType = BackTruncate;
18907 if(TruncateType == BackTruncate)
18927 MovingTrainOccupyingRoute =
true;
18938 if(b ==
int(TruncatePDElementPos))
18944 else if(TruncateType == NextSignalTruncate)
18948 LastElementToBeTruncated = -1;
18949 for(
unsigned int b = TruncatePDElementPos; b <
PrefDirSize(); b++)
18954 LastElementToBeTruncated = int(b) - 1;
18958 for(
int b = LastElementToBeTruncated; b >= 0; b--)
18976 MovingTrainOccupyingRoute =
true;
18987 if(b ==
int(TruncatePDElementPos))
18993 ReinstatementRoute = *
this;
19002 else if(TruncateType == FrontTruncate)
19022 MovingTrainOccupyingRoute =
true;
19033 if(b == TruncatePDElementPos)
19059 MovingTrainOccupyingRoute =
true;
19080 if(((TruncatePDElementPos == 1) && (TruncateType == BackTruncate)) || ((TruncatePDElementPos == (
PrefDirSize() - 2)) && (TruncateType == FrontTruncate)))
19089 if((TruncatePDElementPos > 0) && (TruncateType == BackTruncate))
19096 TrainController->
StopTTClockMessage(145,
"Invalid green or blue route truncation position:\n\nto truncate from the start of the route select a position immediately before a facing signal "
19097 "that lies within the route;\n\nto truncate to the end of the route select a position immediately after a facing signal "
19098 "that lies within the route;\n\nto truncate to the next signal that isn't the end of the route select a signal to truncate from;\n\n"
19099 "or to remove the whole route select the first track element in the route");
19119 else if((TruncatePDElementPos < (
PrefDirSize() - 1)) && (TruncateType == FrontTruncate))
19126 TrainController->
StopTTClockMessage(146,
"Invalid green or blue route truncation position:\n\nto truncate from the start of the route select a position immediately before a facing signal "
19127 "that lies within the route;\n\nto truncate to the end of the route select a position immediately after a facing signal "
19128 "that lies within the route;\n\nto truncate to the next signal that isn't the end of the route select a signal to truncate from;\n\n"
19129 "or to remove the whole route select the first track element in the route");
19155 else if(TruncatePDElementPos == 0)
19162 TrainController->
StopTTClockMessage(148,
"Invalid green or blue route truncation position:\n\nto truncate from the start of the route select a position immediately before a facing signal "
19163 "that lies within the route;\n\nto truncate to the end of the route select a position immediately after a facing signal "
19164 "that lies within the route;\n\nto truncate to the next signal that isn't the end of the route select a signal to truncate from;\n\n"
19165 "or to remove the whole route select the first track element in the route");
19185 int ThisRouteNumber;
19195 if(LRVIT->RouteNumber == ThisRouteNumber)
19206 unsigned int LookBackwardsFromHere = 0;
19207 if((TruncateType == BackTruncate) || (TruncateType == NextSignalTruncate))
19209 LookBackwardsFromHere = TruncatePDElementPos;
19219 if(TruncateType == NextSignalTruncate)
19222 "immediately after the signal, this will lock the remainder of the route ");
19232 int button = Application->MessageBox(L
"Moving train approaching or occupying route, YES to lock route (2 minutes to release), NO to cancel",
19233 L
"Warning!", MB_YESNO | MB_ICONWARNING);
19246 bool ExistingLockedRouteModified =
false;
19248 if(TruncateType == BackTruncate)
19254 else if(TruncateType == FrontTruncate)
19275 if(LRVIT->RouteNumber == ThisRouteNumber)
19279 ExistingLockedRouteModified =
true;
19283 if(!ExistingLockedRouteModified)
19287 if(TruncateType == BackTruncate)
19290 RearPosition = TruncatePDElementPos;
19293 else if(TruncateType == FrontTruncate)
19297 FrontPosition = TruncatePDElementPos;
19306 for(
int c = FrontPosition; c >= RearPosition; c--)
19325 if((TruncateType == BackTruncate) || (TruncateType == NextSignalTruncate))
19327 RearPosition = TruncatePDElementPos;
19331 else if(TruncateType == FrontTruncate)
19334 FrontPosition = TruncatePDElementPos;
19351 for(
int c = FrontPosition; c >= RearPosition; c--)
19357 if(TruncateType == NextSignalTruncate)
19403 TPrefDirElement NewGreenFirstPDElement, NewRedFirstPDElement, NewGreenLastPDElement, NewRedLastPDElement;
19416 if(RouteColour == 1)
19418 NewRedFirstPDElement = LastPDElement;
19422 NewRedFirstPDElement.
IsARoute =
true;
19428 if(R2MMIt->second.first ==
int(x))
19430 R2MMIt->second.second++;
19437 else if(RouteColour == 2)
19439 NewGreenFirstPDElement = LastPDElement;
19443 NewGreenFirstPDElement.
IsARoute =
true;
19449 if(R2MMIt->second.first ==
int(x))
19451 R2MMIt->second.second++;
19474 if(RouteColour == 1)
19476 NewRedLastPDElement = FirstPDElement;
19485 else if(RouteColour == 2)
19487 NewGreenLastPDElement = FirstPDElement;
19556 ARVIt->SetRouteSignals(14);
19575 AnsiString((
short)PrefDirRoute));
19600 AnsiString((
short)PrefDirRoute));
19610 RouteFlashElement.
HLoc = H;
19611 RouteFlashElement.
VLoc = V;
19627 int H = PrefDirPtr->HLoc;
19628 int V = PrefDirPtr->VLoc;
19695 for(
unsigned int x = 0; x < RouteFlashVector.size(); x++)
19701 Display->
PlotOutput(21, RouteFlashVector.at(x).HLoc * 16, RouteFlashVector.at(x).VLoc * 16, RouteFlashVector.at(x).OriginalGraphic);
19704 OverlayPlotted =
false;
19727 bool FirstSignalFound =
false;
19734 if(PDVIt->TrackType ==
Points)
19736 if((PDVIt->ELinkPos == 1) || (PDVIt->XLinkPos == 1))
19747 else if((PDVIt->ELinkPos == 3) || (PDVIt->XLinkPos == 3))
19762 int XLinkPosition = PDVIt->XLinkPos;
19763 if(PDVIt->XLinkPos == -1)
19767 for(
int x = 0; x < 4; x++)
19769 if(PDVIt->Conn[x] == (PDVIt + 1)->TrackVectorPosition)
19782 if(XLinkPosition > -1)
19784 if(!FirstSignalFound && (PDVIt->Config[XLinkPosition] ==
Signal))
19786 FirstSignalFound =
true;
19789 else if(FirstSignalFound && (PDVIt->Config[XLinkPosition] ==
Signal))
19800 IFE.
TVPos = PDVIt->TrackVectorPosition;
19806 " failed when changing aspect.\nTrains can only pass under signaller control.");
19836 if((At < 0) || ((
unsigned int)At >= AllRoutesVector.size()))
19838 throw Exception(
"Out of Range Error, vector size: " + AnsiString(AllRoutesVector.size()) +
", At: " + AnsiString(At) +
" in GetFixedRouteAt");
19841 return(AllRoutesVector.at(At));
19849 if((At < 0) || ((
unsigned int)At >= AllRoutesVector.size()))
19851 throw Exception(
"Out of Range Error, vector size: " + AnsiString(AllRoutesVector.size()) +
", At: " + AnsiString(At) +
" in GetModifiableRouteAt");
19854 return(AllRoutesVector.at(At));
19865 for(
unsigned int a = 0; a < AllRoutesSize(); a++)
19867 GetFixedRouteAt(62, a).PrefDirMarker(7,
RouteCall,
false, Disp);
19877 for(
unsigned int a = 0; a < AllRoutesSize(); a++)
19879 GetFixedRouteAt(166, a).RouteImageMarker(0, Bitmap);
19897 AnsiString(VLoc) +
"," + AnsiString((
short)PrefDirRoute));
19898 for(
unsigned int a = 0; a < AllRoutesSize(); a++)
19902 GetModifiableRouteAt(7, a).TruncateRoute(0, HLoc, VLoc, PrefDirRoute, ReturnFlag);
19931 AnsiString(LinkPos));
19932 if(TrackVectorPosition == -1)
19937 THVPair Route2MultiMapKeyPair;
19941 int EntryLink, EntryLinkPos, ExitLink, ExitLinkPos;
19944 if(Route2MultiMap.count(Route2MultiMapKeyPair) == 0)
19954 if(Route2MultiMap.count(Route2MultiMapKeyPair) == 1)
19956 Route2MultiMapIterator = Route2MultiMap.find(Route2MultiMapKeyPair);
19959 const TPrefDirElement &PrefDirElement1 = GetFixedRouteAt(64, Route2MultiMapIterator->second.first).GetFixedPrefDirElementAt(88,
19960 Route2MultiMapIterator->second.second);
19961 EntryLinkPos = PrefDirElement1.
ELinkPos;
19962 ExitLinkPos = PrefDirElement1.
XLinkPos;
19963 EntryLink = PrefDirElement1.
Link[EntryLinkPos];
19964 ExitLink = PrefDirElement1.
Link[ExitLinkPos];
19976 if(Route2MultiMap.count(Route2MultiMapKeyPair) == 2)
19988 Graphics::TBitmap* &EntryDirectionGraphicPtr)
19998 AnsiString(LinkPos));
20001 if(TrackVectorPosition == -1)
20006 THVPair Route2MultiMapKeyPair;
20010 int EntryLink, EntryLinkPos, ExitLink, ExitLinkPos;
20013 if(Route2MultiMap.count(Route2MultiMapKeyPair) == 0)
20018 if(Route2MultiMap.count(Route2MultiMapKeyPair) == 1)
20020 Route2MultiMapIterator = Route2MultiMap.find(Route2MultiMapKeyPair);
20022 const TPrefDirElement &PrefDirElement1 = GetFixedRouteAt(73, Route2MultiMapIterator->second.first).GetFixedPrefDirElementAt(97,
20023 Route2MultiMapIterator->second.second);
20024 EntryLinkPos = PrefDirElement1.
ELinkPos;
20025 ExitLinkPos = PrefDirElement1.
XLinkPos;
20026 EntryLink = PrefDirElement1.
Link[EntryLinkPos];
20027 ExitLink = PrefDirElement1.
Link[ExitLinkPos];
20031 if((Route2MultiMapIterator->second.second == 0) || (Route2MultiMapIterator->second.second == GetFixedRouteAt(74,
20032 Route2MultiMapIterator->second.first).PrefDirSize() - 1))
20039 return(AutoSigsRoute);
20044 return(NotAutoSigsRoute);
20050 if((Route2MultiMapIterator->second.second == 0) || (Route2MultiMapIterator->second.second == GetFixedRouteAt(75,
20051 Route2MultiMapIterator->second.first).PrefDirSize() - 1))
20058 return(AutoSigsRoute);
20063 return(NotAutoSigsRoute);
20067 if(Route2MultiMap.count(Route2MultiMapKeyPair) == 2)
20069 std::pair<TRoute2MultiMapIterator, TRoute2MultiMapIterator>ItPair;
20070 ItPair = Route2MultiMap.equal_range(Route2MultiMapKeyPair);
20072 const TPrefDirElement &PrefDirElement2 = GetFixedRouteAt(76, ItPair.first->second.first).GetFixedPrefDirElementAt(98, ItPair.first->second.second);
20073 EntryLinkPos = PrefDirElement2.
ELinkPos;
20074 ExitLinkPos = PrefDirElement2.
XLinkPos;
20075 EntryLink = PrefDirElement2.
Link[EntryLinkPos];
20076 ExitLink = PrefDirElement2.
Link[ExitLinkPos];
20080 if((ItPair.first->second.second == 0) || (ItPair.first->second.second == GetFixedRouteAt(77, ItPair.first->second.first).PrefDirSize() - 1))
20087 return(AutoSigsRoute);
20092 return(NotAutoSigsRoute);
20098 if((ItPair.first->second.second == 0) || (ItPair.first->second.second == GetFixedRouteAt(78, ItPair.first->second.first).PrefDirSize() - 1))
20105 return(AutoSigsRoute);
20110 return(NotAutoSigsRoute);
20114 const TPrefDirElement &PrefDirElement3 = GetFixedRouteAt(79, ItPair.second->second.first).GetFixedPrefDirElementAt(99, ItPair.second->second.second);
20115 EntryLinkPos = PrefDirElement3.
ELinkPos;
20116 ExitLinkPos = PrefDirElement3.
XLinkPos;
20117 EntryLink = PrefDirElement3.
Link[EntryLinkPos];
20118 ExitLink = PrefDirElement3.
Link[ExitLinkPos];
20122 if((ItPair.second->second.second == 0) || (ItPair.second->second.second == GetFixedRouteAt(80, ItPair.second->second.first).PrefDirSize() - 1))
20129 return(AutoSigsRoute);
20134 return(NotAutoSigsRoute);
20140 if((ItPair.second->second.second == 0) || (ItPair.second->second.second == GetFixedRouteAt(81, ItPair.second->second.first).PrefDirSize() - 1))
20147 return(AutoSigsRoute);
20152 return(NotAutoSigsRoute);
20168 AnsiString(LinkPos));
20169 if(TrackVectorPosition == -1)
20175 THVPair Route2MultiMapKeyPair;
20179 int EntryLink, EntryLinkPos, ExitLink, ExitLinkPos;
20182 if(Route2MultiMap.count(Route2MultiMapKeyPair) == 0)
20188 if(Route2MultiMap.count(Route2MultiMapKeyPair) == 1)
20190 Route2MultiMapIterator = Route2MultiMap.find(Route2MultiMapKeyPair);
20192 const TPrefDirElement &PrefDirElement1 = GetFixedRouteAt(82, Route2MultiMapIterator->second.first).GetFixedPrefDirElementAt(100,
20193 Route2MultiMapIterator->second.second);
20194 EntryLinkPos = PrefDirElement1.
ELinkPos;
20195 ExitLinkPos = PrefDirElement1.
XLinkPos;
20196 EntryLink = PrefDirElement1.
Link[EntryLinkPos];
20197 ExitLink = PrefDirElement1.
Link[ExitLinkPos];
20200 RouteNumber = Route2MultiMapIterator->second.first;
20204 return(AutoSigsRoute);
20209 return(NotAutoSigsRoute);
20214 RouteNumber = Route2MultiMapIterator->second.first;
20218 return(AutoSigsRoute);
20223 return(NotAutoSigsRoute);
20227 if(Route2MultiMap.count(Route2MultiMapKeyPair) == 2)
20229 std::pair<TRoute2MultiMapIterator, TRoute2MultiMapIterator>ItPair;
20230 ItPair = Route2MultiMap.equal_range(Route2MultiMapKeyPair);
20232 const TPrefDirElement &PrefDirElement2 = GetFixedRouteAt(83, ItPair.first->second.first).GetFixedPrefDirElementAt(101, ItPair.first->second.second);
20233 EntryLinkPos = PrefDirElement2.
ELinkPos;
20234 ExitLinkPos = PrefDirElement2.
XLinkPos;
20235 EntryLink = PrefDirElement2.
Link[EntryLinkPos];
20236 ExitLink = PrefDirElement2.
Link[ExitLinkPos];
20239 RouteNumber = ItPair.first->second.first;
20243 return(AutoSigsRoute);
20248 return(NotAutoSigsRoute);
20253 RouteNumber = ItPair.first->second.first;
20257 return(AutoSigsRoute);
20262 return(NotAutoSigsRoute);
20266 const TPrefDirElement &PrefDirElement3 = GetFixedRouteAt(84, ItPair.second->second.first).GetFixedPrefDirElementAt(102, ItPair.second->second.second);
20267 EntryLinkPos = PrefDirElement3.
ELinkPos;
20268 ExitLinkPos = PrefDirElement3.
XLinkPos;
20269 EntryLink = PrefDirElement3.
Link[EntryLinkPos];
20270 ExitLink = PrefDirElement3.
Link[ExitLinkPos];
20273 RouteNumber = ItPair.second->second.first;
20277 return(AutoSigsRoute);
20282 return(NotAutoSigsRoute);
20287 RouteNumber = ItPair.second->second.first;
20291 return(AutoSigsRoute);
20296 return(NotAutoSigsRoute);
20318 EmptyRoute.
RouteID = NextRouteID;
20321 AllRoutesVector.push_back(EmptyRoute);
20322 for(
unsigned int x = 0; x < Route->
PrefDirSize(); x++)
20346 AllRoutesVector.push_back(EmptyRoute);
20347 for(
unsigned int x = 0; x < Route->
PrefDirSize(); x++)
20370 THVPair Route2MultiMapKeyPair;
20379 LockedRouteRearTrackVectorPosition = 0;
20380 LockedRouteLastTrackVectorPosition = 0;
20381 LockedRouteLastXLinkPos = 0;
20382 LockedRouteLockStartTime = TDateTime(0);
20383 if(!LockedRouteVector.empty())
20387 if(LRVIT->RouteNumber == RouteNumber)
20389 LockedRouteRearTrackVectorPosition = LRVIT->RearTrackVectorPosition;
20390 LockedRouteLastTrackVectorPosition = LRVIT->LastTrackVectorPosition;
20391 LockedRouteLastXLinkPos = LRVIT->LastXLinkPos;
20392 LockedRouteLockStartTime = LRVIT->LockStartTime;
20393 LockedRouteFoundDuringRouteBuilding =
true;
20394 LockedRouteVector.erase(LRVIT);
20419 AnsiString(VLoc) +
"," + AnsiString(ELink));
20422 ReturnPair.first = -1;
20423 ReturnPair.second = 0;
20424 THVPair Route2MultiMapKeyPair;
20426 Route2MultiMapKeyPair.first = HLoc;
20427 Route2MultiMapKeyPair.second = VLoc;
20430 Route2MultiMapEntry.first = Route2MultiMapKeyPair;
20431 std::pair<TRoute2MultiMapIterator, TRoute2MultiMapIterator>ItPair;
20433 ItPair = Route2MultiMap.equal_range(Route2MultiMapKeyPair);
20434 Route2MultiMapIterator = ItPair.first;
20436 if(ItPair.first == ItPair.second)
20438 throw Exception(
"Failed to find Route2MultiMap element at HLoc = " + (AnsiString)HLoc +
" VLoc = " + (AnsiString)VLoc);
20440 if(GetFixedRouteAt(111, ItPair.first->second.first).GetFixedPrefDirElementAt(132, ItPair.first->second.second).GetELink() == ELink)
20442 ReturnPair.first = ItPair.first->second.first;
20443 ReturnPair.second = ItPair.first->second.second;
20444 Route2MultiMapIterator = ItPair.first;
20446 return(ReturnPair);
20449 if(ItPair.first == ItPair.second)
20451 throw Exception(
"Found Route2MultiMap element at HLoc = " + (AnsiString)HLoc +
" VLoc = " + (AnsiString)VLoc +
" but failed to find required element");
20453 if(GetFixedRouteAt(112, ItPair.first->second.first).GetFixedPrefDirElementAt(133, ItPair.first->second.second).GetELink() == ELink)
20455 ReturnPair.first = ItPair.first->second.first;
20456 ReturnPair.second = ItPair.first->second.second;
20457 Route2MultiMapIterator = ItPair.first;
20459 return(ReturnPair);
20462 return(ReturnPair);
20477 AnsiString(VLoc) +
"," + AnsiString(ELink));
20478 THVPair Route2MultiMapKeyPair;
20480 Route2MultiMapKeyPair.first = HLoc;
20481 Route2MultiMapKeyPair.second = VLoc;
20482 std::pair<TRoute2MultiMapIterator, TRoute2MultiMapIterator>ItPair;
20484 ItPair = Route2MultiMap.equal_range(Route2MultiMapKeyPair);
20486 if(ItPair.first == ItPair.second)
20492 if(GetFixedRouteAt(205, ItPair.first->second.first).GetFixedPrefDirElementAt(241, ItPair.first->second.second).GetELink() == ELink)
20494 RouteNumber = ItPair.first->second.first;
20500 if(ItPair.first == ItPair.second)
20506 if(GetFixedRouteAt(206, ItPair.first->second.first).GetFixedPrefDirElementAt(242, ItPair.first->second.second).GetELink() == ELink)
20508 RouteNumber = ItPair.first->second.first;
20529 "," + AnsiString(ELinkIn) +
"," + AnsiString(RouteNumber) +
"," + AnsiString(RouteElementNumber));
20530 THVPair Route2MultiMapKeyPair;
20532 Route2MultiMapKeyPair.first = HLoc;
20533 Route2MultiMapKeyPair.second = VLoc;
20536 Route2MultiMapEntry.first = Route2MultiMapKeyPair;
20539 RouteElementPair.first = RouteNumber;
20540 RouteElementPair.second = RouteElementNumber;
20541 Route2MultiMapEntry.second = RouteElementPair;
20543 if(Route2MultiMap.find(Route2MultiMapKeyPair) != Route2MultiMap.end())
20546 if(GetFixedRouteAt(113, Route2MultiMap.find(Route2MultiMapKeyPair)->second.first).GetFixedPrefDirElementAt(134,
20547 Route2MultiMap.find(Route2MultiMapKeyPair)->second.second).GetELink() != ELinkIn)
20550 if(GetFixedRouteAt(114, Route2MultiMap.find(Route2MultiMapKeyPair)->second.first).GetFixedPrefDirElementAt(135,
20551 Route2MultiMap.find(Route2MultiMapKeyPair)->second.second).TrackType !=
Bridge)
20553 throw Exception(
"Error, bridge expected in Route2MultiMapInsert but not, at HLoc=" + AnsiString(HLoc) +
" VLoc=" + AnsiString(VLoc));
20555 Route2MultiMap.insert(Route2MultiMapEntry);
20560 throw Exception(
"Error, route map entry found in Route2MultiMapInsert at HLoc=" + AnsiString(HLoc) +
" VLoc=" + AnsiString(VLoc));
20565 Route2MultiMap.insert(Route2MultiMapEntry);
20583 TempPair.first = -1;
20584 TempPair.second = 0;
20585 SecondPair = TempPair;
20587 std::pair<TRoute2MultiMapIterator, TRoute2MultiMapIterator>ItRange;
20588 THVPair Route2MultiMapKeyPair;
20590 Route2MultiMapKeyPair.first = HLoc;
20591 Route2MultiMapKeyPair.second = VLoc;
20592 if(Route2MultiMap.count(Route2MultiMapKeyPair) == 0)
20597 else if(Route2MultiMap.count(Route2MultiMapKeyPair) == 1)
20599 Route2MultiMapIterator = Route2MultiMap.find(Route2MultiMapKeyPair);
20601 return(Route2MultiMapIterator->second);
20603 else if(Route2MultiMap.count(Route2MultiMapKeyPair) == 2)
20605 ItRange = Route2MultiMap.equal_range(Route2MultiMapKeyPair);
20606 TempPair = ItRange.first->second;
20607 SecondPair = (--ItRange.second)->second;
20630 TRouteElementPair RouteElementPair = GetRouteElementDataFromRoute2MultiMap(8, CheckElement.
HLoc, CheckElement.
VLoc, SecondPair);
20631 if(RouteElementPair.first == -1)
20634 throw Exception(
"CheckMapAndRoutes Error - failed to find HLoc=" + (AnsiString)CheckElement.
HLoc +
" VLoc=" + (AnsiString)CheckElement.
VLoc +
20635 " in Route2MultiMap, Caller=" + (AnsiString)Caller);
20637 if((RouteElementPair.first != (
int)a) && (SecondPair.first != (
int)a))
20640 throw Exception(
"CheckMapAndRoutes Error - RouteNumber failed at HLoc=" + (AnsiString)CheckElement.
HLoc +
" VLoc=" +
20641 (AnsiString)CheckElement.
VLoc +
" Map value=" + (AnsiString)RouteElementPair.first +
" Route value=" + (AnsiString)a +
" Caller=" +
20642 (AnsiString)Caller);
20644 if(((RouteElementPair.first != (
int)a) || (RouteElementPair.second != b)) && ((SecondPair.first != (
int)a) || (SecondPair.second != b)))
20647 throw Exception(
"CheckMapAndRoutes Error - PrefDirVectorNumber failed at HLoc=" + (AnsiString)CheckElement.
HLoc +
" VLoc=" +
20648 (AnsiString)CheckElement.
VLoc +
" 1st Map value RouteNum/ElementNum =" + (AnsiString)RouteElementPair.first +
"/" +
20649 (AnsiString)RouteElementPair.second +
" 2nd Map value =" + (AnsiString)SecondPair.first +
"/" + (AnsiString)SecondPair.second +
20650 " Route value=" + (AnsiString)a +
"/" + (AnsiString)b +
" Caller=" + (AnsiString)Caller);
20654 unsigned int SizeVal = 0;
20657 for(
unsigned int a = 0; a < AllRoutesSize(); a++)
20659 SizeVal += GetFixedRouteAt(117, a).PrefDirSize();
20661 if(SizeVal != Route2MultiMap.size())
20663 throw Exception(
"CheckMapAndRoutes Error - Map Size=" + (AnsiString)Route2MultiMap.size() +
" RouteSize=" + (AnsiString)SizeVal +
" Caller=" +
20664 (AnsiString)Caller);
20680 if(!Route2MultiMap.empty())
20682 for(
TRoute2MultiMapIterator Route2MultiMapIterator = Route2MultiMap.begin(); Route2MultiMapIterator != Route2MultiMap.end(); Route2MultiMapIterator++)
20684 if(Route2MultiMapIterator->second.first > RouteNumber)
20686 Route2MultiMapIterator->second.first--;
20703 AnsiString(RouteNumber) +
"," + AnsiString(ErasedElementNumber));
20704 if(!Route2MultiMap.empty())
20706 for(
TRoute2MultiMapIterator Route2MultiMapIterator = Route2MultiMap.begin(); Route2MultiMapIterator != Route2MultiMap.end(); Route2MultiMapIterator++)
20708 if((Route2MultiMapIterator->second.first == RouteNumber) && (Route2MultiMapIterator->second.second > ErasedElementNumber))
20710 Route2MultiMapIterator->second.second--;
20729 AnsiString(ELink));
20733 RequiredRoutePair = FindRoutePairFromRoute2MultiMap(0, HLoc, VLoc, ELink, Route2MultiMapIterator);
20734 if(RequiredRoutePair.first == -1)
20736 throw Exception(
"Failed to find route element in RemoveRouteElement");
20738 Route2MultiMap.erase(Route2MultiMapIterator);
20739 DecrementRouteElementNumbersInRoute2MultiMap(0, RequiredRoutePair.first, RequiredRoutePair.second);
20742 TPrefDirElement LockedRouteElement, PrefDirElement = GetFixedRouteAt(118, RequiredRoutePair.first).GetFixedPrefDirElementAt(137, RequiredRoutePair.second);
20763 GetModifiableRouteAt(8, RequiredRoutePair.first).PrefDirVector.erase(GetModifiableRouteAt(33, RequiredRoutePair.first).PrefDirVector.begin() + RequiredRoutePair.second);
20774 if(AutoSigVectorIT->RouteNumber == RequiredRoutePair.first)
20782 if(GetModifiableRouteAt(10, RequiredRoutePair.first).PrefDirSize() == 0)
20784 TrainController->
LogEvent(
"RouteRemoved," + AnsiString(GetFixedRouteAt(189, RequiredRoutePair.first).RouteID));
20785 AllRoutesVector.erase(AllRoutesVector.begin() + RequiredRoutePair.first);
20786 DecrementRouteNumbersInRoute2MultiMap(0, RequiredRoutePair.first);
20798 if(!LockedRouteVector.empty())
20802 if(LRVIT->RouteNumber > RequiredRoutePair.first)
20804 LRVIT->RouteNumber--;
20814 if(AutoSigVectorIT->RouteNumber > RequiredRoutePair.first)
20816 AutoSigVectorIT->RouteNumber--;
20821 CheckMapAndRoutes(7);
20835 AnsiString(ELink) +
"," + AnsiString(RouteNumber) +
"," + RouteElement.
LogPrefDir());
20836 GetModifiableRouteAt(11, RouteNumber).StoreRouteElementInPrefDirVector(RouteElement);
20837 Route2MultiMapInsert(0, HLoc, VLoc, ELink, RouteNumber, GetModifiableRouteAt(12, RouteNumber).
PrefDirSize() - 1);
20854 "," + AnsiString(XLinkPos));
20858 RouteElementPair = GetRouteElementDataFromRoute2MultiMap(9, TE.
HLoc, TE.
VLoc, SecondPair);
20859 if(RouteElementPair.first == -1)
20861 throw Exception(
"Error, failed to find element in SetTrailingSignalsOnAutoSigsRoute - 1");
20863 TPrefDirElement RouteElement = GetFixedRouteAt(119, RouteElementPair.first).GetFixedPrefDirElementAt(138, RouteElementPair.second);
20865 RequiredPair = RouteElementPair;
20866 if(RouteElement.
XLinkPos != XLinkPos)
20868 if(SecondPair.first != -1)
20870 RouteElement = GetFixedRouteAt(120, SecondPair.first).GetFixedPrefDirElementAt(139, SecondPair.second);
20871 RequiredPair = SecondPair;
20872 if(RouteElement.
XLinkPos != XLinkPos)
20874 throw Exception(
"Failed to find element in route in SetTrailingSignalsOnAutoSigsRoute - 2");
20879 throw Exception(
"Failed to find element in route in SetTrailingSignalsOnAutoSigsRoute - 3");
20883 SetAllRearwardsSignals(5, 0, RequiredPair.first, RequiredPair.second);
20904 AnsiString(AccessNumber));
20906 int Attribute = AccessNumber;
20908 int x = GetFixedRouteAt(121, RouteNumber).PrefDirSize() - 1;
20912 throw Exception(
"Error - route not AutoSignals in SetTrailingSignalsOnContinuationRoute");
20916 throw Exception(
"Error - end element not continuation in SetTrailingSignalsOnContinuationRoute");
20919 x).XLinkPos] !=
End)
20921 throw Exception(
"Error - end element a continuation in SetTrailingSignalsOnContinuationRoute but End not facing right way");
20924 SetAllRearwardsSignals(6, Attribute, RouteNumber, GetFixedRouteAt(126, RouteNumber).
PrefDirSize() - 1);
20975 AnsiString(RouteNumber) +
"," + AnsiString(RouteStartPosition));
20976 TPrefDirElement FirstElement = GetFixedRouteAt(127, RouteNumber).GetFixedPrefDirElementAt(144, 0);
20977 int RearwardLinkedRouteNumber;
20980 bool SkipForwardLook =
false;
20989 SkipForwardLook =
true;
20991 RearwardLinkedRouteNumber).
PrefDirSize() - 1, SkipForwardLook)))
21001 int TrainID, TrainPosition, BehindTrainPosition;
21002 bool FoundTrain =
false, BehindTrain =
false;
21003 for(
int x = RouteStartPosition; x >= 0; x--)
21005 TPrefDirElement PrefDirElement = GetFixedRouteAt(132, RouteNumber).GetFixedPrefDirElementAt(146, x);
21030 if(FoundTrain && (TrainPosition > 1))
21034 for(
int x = TrainPosition; x >= 0; x--)
21038 TPrefDirElement PrefDirElement = GetFixedRouteAt(133, RouteNumber).GetFixedPrefDirElementAt(147, x);
21058 BehindTrain =
true;
21059 BehindTrainPosition = x;
21066 SetAllRearwardsSignals(7, 0, RouteNumber, BehindTrainPosition);
21083 AnsiString(LookBackwardsFromHere));
21084 int SignalCount = 0, TrainID, RearwardLinkedRouteNumber;
21085 TOneRoute CurrentRoute = GetFixedRouteAt(134, RouteNumber);
21088 bool ExamineRoute =
true;
21090 while(ExamineRoute)
21092 for(
int x = LookBackwardsFromHere; x >= 0; x--)
21137 if(SignalCount >= 3)
21152 LookBackwardsFromHere = CurrentRoute.
PrefDirSize() - 1;
21156 CurrentRoute = GetFixedRouteAt(135, RearwardLinkedRouteNumber);
21157 ExamineRoute =
true;
21158 LookBackwardsFromHere = GetFixedRouteAt(136, RearwardLinkedRouteNumber).PrefDirSize() - 1;
21193 ExamineRoute =
false;
21208 AnsiString(TrackVectorPosition) +
"," + AnsiString(XLinkPos));
21211 PrefDirElement = InternalPrefDirElement;
21212 if(LockedRouteVector.empty())
21219 bool InLockedRoute =
false;
21223 if(TrackIsInARoute(14, LRVIT->LastTrackVectorPosition, LRVIT->LastXLinkPos))
21227 InLockedRoute =
true;
21236 int RouteNumber, VectorCount = 0;
21241 RouteType = GetRouteTypeAndNumber(8, LRVIT->LastTrackVectorPosition, LRVIT->LastXLinkPos, RouteNumber);
21242 if(RouteType == NoRoute)
21255 for(
int x = GetFixedRouteAt(141, RouteNumber).
PrefDirSize() - 1; x >= 0; x--)
21257 InternalPrefDirElement = GetFixedRouteAt(142, RouteNumber).GetFixedPrefDirElementAt(152, x);
21262 PrefDirElement = InternalPrefDirElement;
21263 LockedVectorNumber = VectorCount;
21268 else if(InternalPrefDirElement.
TrackVectorPosition == (
int)LRVIT->RearTrackVectorPosition)
21272 PrefDirElement = InternalPrefDirElement;
21273 LockedVectorNumber = VectorCount;
21294 for(
unsigned int x = 0; x < AllRoutesSize(); x++)
21296 if(GetFixedRouteAt(157, x).RouteID ==
RouteID.GetInt())
21302 throw Exception(
"Error, failed to find RouteID in GetRouteVectorNumber for ID: " + AnsiString(
RouteID.GetInt()));
21312 for(
unsigned int x = 0; x < AllRoutesSize(); x++)
21314 if(GetFixedRouteAt(45, x).RouteID ==
RouteID.GetInt())
21329 for(
unsigned int x = 0; x < AllRoutesSize(); x++)
21331 if(GetFixedRouteAt(163, x).RouteID ==
RouteID.GetInt())
21334 return(GetFixedRouteAt(159, x));
21337 throw Exception(
"Error, failed to find RouteID in GetFixedRouteAtIDNumber for ID: " + AnsiString(
RouteID.GetInt()));
21345 for(
unsigned int x = 0; x < AllRoutesSize(); x++)
21347 if(GetFixedRouteAt(164, x).RouteID ==
RouteID.GetInt())
21350 return(GetModifiableRouteAt(15, x));
21353 throw Exception(
"Error, failed to find RouteID in GetModifiableRouteAtIDNumber for ID: " + AnsiString(
RouteID.GetInt()));
21363 for(
unsigned int x = 0; x < AllRoutesSize(); x++)
21365 TOneRoute OneRoute = GetFixedRouteAt(165, x);
21377 int NumberOfRoutes;
21381 for(
int x = 0; x < NumberOfRoutes; x++)
21388 StoreOneRouteAfterSessionLoad(0, &OneRoute);
21406 if((NumberOfRoutes < 0) || (NumberOfRoutes > 10000))
21413 if((NextID < 0) || (NextID > 1000000))
21418 for(
int x = 0; x < NumberOfRoutes; x++)
21443 AnsiString(StartPosition));
21444 if(EndPosition == StartPosition)
21450 int TVPos = EndPosition;
21451 int LkPos = EndXLinkPos;
21453 while(TrackIsInARoute(15, TVPos, LkPos))
21480 if(GetRouteTypeAndNumber(36, NewTVPos, NewLkPos, RouteNumber) == NoRoute)
21489 if((NewLkPos == 0) || (NewLkPos == 2))
21509 if(TVPos == StartPosition)
21541 AnsiString(VLoc) +
"," + AnsiString(DiagonalLinkNumber));
21546 if(FirstPair.first > -1)
21549 if((DiagonalLinkNumber == 1) && ((TempPrefDirElement.
ELink == 3) || (TempPrefDirElement.
XLink == 3)))
21554 if((DiagonalLinkNumber == 7) && ((TempPrefDirElement.
ELink == 9) || (TempPrefDirElement.
XLink == 9)))
21560 if(SecondPair.first > -1)
21563 if((DiagonalLinkNumber == 1) && ((TempPrefDirElement.
ELink == 3) || (TempPrefDirElement.
XLink == 3)))
21568 if((DiagonalLinkNumber == 7) && ((TempPrefDirElement.
ELink == 9) || (TempPrefDirElement.
XLink == 9)))
21574 if(((DiagonalLinkNumber == 1) &&
Track->
TrainOnLink(0, HLoc - 1, VLoc, 3, TrainID)) || ((DiagonalLinkNumber == 7) &&
Track->
TrainOnLink(1, HLoc - 1, VLoc,
21581 if(FirstPair.first > -1)
21584 if((DiagonalLinkNumber == 1) && ((TempPrefDirElement.
ELink == 7) || (TempPrefDirElement.
XLink == 7)))
21589 if((DiagonalLinkNumber == 3) && ((TempPrefDirElement.
ELink == 9) || (TempPrefDirElement.
XLink == 9)))
21595 if(SecondPair.first > -1)
21598 if((DiagonalLinkNumber == 1) && ((TempPrefDirElement.
ELink == 7) || (TempPrefDirElement.
XLink == 7)))
21603 if((DiagonalLinkNumber == 3) && ((TempPrefDirElement.
ELink == 9) || (TempPrefDirElement.
XLink == 9)))
21609 if(((DiagonalLinkNumber == 1) &&
Track->
TrainOnLink(2, HLoc, VLoc - 1, 7, TrainID)) || ((DiagonalLinkNumber == 3) &&
Track->
TrainOnLink(3, HLoc, VLoc - 1,
21616 if(FirstPair.first > -1)
21619 if((DiagonalLinkNumber == 3) && ((TempPrefDirElement.
ELink == 1) || (TempPrefDirElement.
XLink == 1)))
21624 if((DiagonalLinkNumber == 9) && ((TempPrefDirElement.
ELink == 7) || (TempPrefDirElement.
XLink == 7)))
21630 if(SecondPair.first > -1)
21633 if((DiagonalLinkNumber == 3) && ((TempPrefDirElement.
ELink == 1) || (TempPrefDirElement.
XLink == 1)))
21638 if((DiagonalLinkNumber == 9) && ((TempPrefDirElement.
ELink == 7) || (TempPrefDirElement.
XLink == 7)))
21644 if(((DiagonalLinkNumber == 3) &&
Track->
TrainOnLink(4, HLoc + 1, VLoc, 1, TrainID)) || ((DiagonalLinkNumber == 9) &&
Track->
TrainOnLink(5, HLoc + 1, VLoc,
21651 if(FirstPair.first > -1)
21654 if((DiagonalLinkNumber == 7) && ((TempPrefDirElement.
ELink == 1) || (TempPrefDirElement.
XLink == 1)))
21659 if((DiagonalLinkNumber == 9) && ((TempPrefDirElement.
ELink == 3) || (TempPrefDirElement.
XLink == 3)))
21665 if(SecondPair.first > -1)
21668 if((DiagonalLinkNumber == 7) && ((TempPrefDirElement.
ELink == 1) || (TempPrefDirElement.
XLink == 1)))
21673 if((DiagonalLinkNumber == 9) && ((TempPrefDirElement.
ELink == 3) || (TempPrefDirElement.
XLink == 3)))
21679 if(((DiagonalLinkNumber == 7) &&
Track->
TrainOnLink(6, HLoc, VLoc + 1, 1, TrainID)) || ((DiagonalLinkNumber == 9) &&
Track->
TrainOnLink(7, HLoc, VLoc + 1,
21703 "," + AnsiString(DiagonalLinkNumber));
21708 if(FirstPair.first > -1)
21711 if((DiagonalLinkNumber == 1) && ((TempPrefDirElement.
ELink == 3) || (TempPrefDirElement.
XLink == 3)))
21716 if((DiagonalLinkNumber == 7) && ((TempPrefDirElement.
ELink == 9) || (TempPrefDirElement.
XLink == 9)))
21722 if(SecondPair.first > -1)
21725 if((DiagonalLinkNumber == 1) && ((TempPrefDirElement.
ELink == 3) || (TempPrefDirElement.
XLink == 3)))
21730 if((DiagonalLinkNumber == 7) && ((TempPrefDirElement.
ELink == 9) || (TempPrefDirElement.
XLink == 9)))
21737 if(FirstPair.first > -1)
21740 if((DiagonalLinkNumber == 1) && ((TempPrefDirElement.
ELink == 7) || (TempPrefDirElement.
XLink == 7)))
21745 if((DiagonalLinkNumber == 3) && ((TempPrefDirElement.
ELink == 9) || (TempPrefDirElement.
XLink == 9)))
21751 if(SecondPair.first > -1)
21754 if((DiagonalLinkNumber == 1) && ((TempPrefDirElement.
ELink == 7) || (TempPrefDirElement.
XLink == 7)))
21759 if((DiagonalLinkNumber == 3) && ((TempPrefDirElement.
ELink == 9) || (TempPrefDirElement.
XLink == 9)))
21766 if(FirstPair.first > -1)
21769 if((DiagonalLinkNumber == 3) && ((TempPrefDirElement.
ELink == 1) || (TempPrefDirElement.
XLink == 1)))
21774 if((DiagonalLinkNumber == 9) && ((TempPrefDirElement.
ELink == 7) || (TempPrefDirElement.
XLink == 7)))
21780 if(SecondPair.first > -1)
21783 if((DiagonalLinkNumber == 3) && ((TempPrefDirElement.
ELink == 1) || (TempPrefDirElement.
XLink == 1)))
21788 if((DiagonalLinkNumber == 9) && ((TempPrefDirElement.
ELink == 7) || (TempPrefDirElement.
XLink == 7)))
21795 if(FirstPair.first > -1)
21798 if((DiagonalLinkNumber == 7) && ((TempPrefDirElement.
ELink == 1) || (TempPrefDirElement.
XLink == 1)))
21803 if((DiagonalLinkNumber == 9) && ((TempPrefDirElement.
ELink == 3) || (TempPrefDirElement.
XLink == 3)))
21809 if(SecondPair.first > -1)
21812 if((DiagonalLinkNumber == 7) && ((TempPrefDirElement.
ELink == 1) || (TempPrefDirElement.
XLink == 1)))
21817 if((DiagonalLinkNumber == 9) && ((TempPrefDirElement.
ELink == 3) || (TempPrefDirElement.
XLink == 3)))